Java Code Examples for org.apache.mesos.Protos#SlaveID

The following examples show how to use org.apache.mesos.Protos#SlaveID . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultV3TaskInfoRequestFactory.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Override
public TaskInfoRequest newTaskInfo(TitusQueuableTask<Job, Task> fenzoTask,
                                   Job<?> job,
                                   Task task,
                                   String hostname,
                                   Map<String, String> attributesMap,
                                   Protos.SlaveID slaveID,
                                   PreferentialNamedConsumableResourceSet.ConsumeResult consumeResult,
                                   Optional<String> executorUriOverrideOpt,
                                   Map<String, String> passthroughAttributes) {
    String taskId = task.getId();
    Protos.TaskID protoTaskId = Protos.TaskID.newBuilder().setValue(taskId).build();
    Protos.ExecutorInfo executorInfo = newExecutorInfo(task, attributesMap, executorUriOverrideOpt);
    Protos.TaskInfo.Builder taskInfoBuilder = newTaskInfoBuilder(protoTaskId, executorInfo, slaveID, fenzoTask, job, task);
    ContainerInfo.Builder containerInfoBuilder = newContainerInfoBuilder(job, task, fenzoTask, passthroughAttributes);
    taskInfoBuilder.setData(containerInfoBuilder.build().toByteString());
    return new TaskInfoRequest(job, task, taskInfoBuilder.build(), containerInfoBuilder.getPassthroughAttributesMap());
}
 
Example 2
Source File: MesosResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void executorLost(SchedulerDriver driver, final Protos.ExecutorID executorId, final Protos.SlaveID slaveId, final int status) {
	runAsync(new Runnable() {
		@Override
		public void run() {
			MesosResourceManager.this.executorLost(new ExecutorLost(executorId, slaveId, status));
		}
	});
}
 
Example 3
Source File: REEFScheduler.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void frameworkMessage(final SchedulerDriver driver,
                             final Protos.ExecutorID executorId,
                             final Protos.SlaveID slaveId,
                             final byte[] data) {
  LOG.log(Level.INFO, "Framework Message. driver: {0} executorId: {1} slaveId: {2} data: {3}",
      new Object[]{driver, executorId, slaveId, data});
}
 
Example 4
Source File: MesosWorkerStore.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private Worker(Protos.TaskID taskID, ResourceProfile profile,
		Option<Protos.SlaveID> slaveID, Option<String> hostname, WorkerState state) {
	this.taskID = requireNonNull(taskID, "taskID");
	this.profile = requireNonNull(profile, "profile");
	this.slaveID = requireNonNull(slaveID, "slaveID");
	this.hostname = requireNonNull(hostname, "hostname");
	this.state = requireNonNull(state, "state");
}
 
Example 5
Source File: FrameworkScheduler.java    From dcos-commons with Apache License 2.0 5 votes vote down vote up
@Override
public void executorLost(
    SchedulerDriver driver,
    Protos.ExecutorID executorId,
    Protos.SlaveID agentId,
    int status)
{
  try {
    LOGGER.warn("Lost Executor: {} on Agent: {}", executorId.getValue(), agentId.getValue());
  } catch (Throwable e) {
    logExceptionAndExit(e);
  }
}
 
Example 6
Source File: MesosWorkerStore.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Get the worker's assigned slave ID.
 */
public Option<Protos.SlaveID> slaveID() {
	return slaveID;
}
 
Example 7
Source File: MesosFramework.java    From incubator-heron with Apache License 2.0 4 votes vote down vote up
@Override
public void slaveLost(SchedulerDriver schedulerDriver, Protos.SlaveID slaveID) {
  // TODO(mfu): TO handle this failure
  LOG.info("Slave lost: " + slaveID.toString());
}
 
Example 8
Source File: ExecutorLost.java    From flink with Apache License 2.0 4 votes vote down vote up
public ExecutorLost(Protos.ExecutorID executorId, Protos.SlaveID slaveId, int status) {
	this.executorId = executorId;
	this.slaveId = slaveId;
	this.status = status;
}
 
Example 9
Source File: FrameworkMessage.java    From flink with Apache License 2.0 4 votes vote down vote up
public Protos.SlaveID slaveId() {
	return slaveId;
}
 
Example 10
Source File: SlaveLost.java    From flink with Apache License 2.0 4 votes vote down vote up
public SlaveLost(Protos.SlaveID slaveId) {
	this.slaveId = slaveId;
}
 
Example 11
Source File: SimulatedRemoteMesosSchedulerDriver.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public Protos.Status sendFrameworkMessage(Protos.ExecutorID executorId, Protos.SlaveID slaveId, byte[] data) {
    throw new IllegalStateException("method not supported");
}
 
Example 12
Source File: ExecutorLost.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public Protos.SlaveID slaveId() {
	return slaveId;
}
 
Example 13
Source File: DefaultV3TaskInfoRequestFactory.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
private Protos.TaskInfo.Builder newTaskInfoBuilder(Protos.TaskID taskId,
                                                   Protos.ExecutorInfo executorInfo,
                                                   Protos.SlaveID slaveID,
                                                   TitusQueuableTask<Job, Task> fenzoTask,
                                                   Job<?> job,
                                                   Task task
) {

    // use requested CPUs rather than what Fenzo assigned, since some CPUs could have been scheduled
    // opportunistically (oversubscribed)
    double requestedCpus = job.getJobDescriptor().getContainer().getContainerResources().getCpu();
    Protos.TaskInfo.Builder builder = Protos.TaskInfo.newBuilder()
            .setTaskId(taskId)
            .setName(taskId.getValue())
            .setExecutor(executorInfo)
            .setSlaveId(slaveID)
            .addResources(Protos.Resource.newBuilder()
                    .setName("cpus")
                    .setType(Protos.Value.Type.SCALAR)
                    .setScalar(Protos.Value.Scalar.newBuilder().setValue(requestedCpus).build()))
            .addResources(Protos.Resource.newBuilder()
                    .setName("mem")
                    .setType(Protos.Value.Type.SCALAR)
                    .setScalar(Protos.Value.Scalar.newBuilder().setValue(fenzoTask.getMemory()).build()))
            .addResources(Protos.Resource.newBuilder()
                    .setName("disk")
                    .setType(Protos.Value.Type.SCALAR)
                    .setScalar(Protos.Value.Scalar.newBuilder().setValue(fenzoTask.getDisk()).build()))
            .addResources(Protos.Resource.newBuilder()
                    .setName("network")
                    .setType(Protos.Value.Type.SCALAR)
                    .setScalar(Protos.Value.Scalar.newBuilder().setValue(fenzoTask.getNetworkMbps())));

    if (fenzoTask.isCpuOpportunistic() && fenzoTask.getOpportunisticCpus() > 0) {
        builder.addResources(Protos.Resource.newBuilder()
                .setName("opportunisticCpus")
                .setType(Protos.Value.Type.SCALAR)
                .setScalar(Protos.Value.Scalar.newBuilder().setValue(fenzoTask.getOpportunisticCpus()).build())
        );
    }

    // set scalars other than cpus, mem, disk
    final Map<String, Double> scalars = fenzoTask.getScalarRequests();
    if (scalars != null && !scalars.isEmpty()) {
        for (Map.Entry<String, Double> entry : scalars.entrySet()) {
            if (!Container.PRIMARY_RESOURCES.contains(entry.getKey())) { // Already set above
                builder.addResources(Protos.Resource.newBuilder()
                        .setName(entry.getKey())
                        .setType(Protos.Value.Type.SCALAR)
                        .setScalar(Protos.Value.Scalar.newBuilder().setValue(entry.getValue()).build())
                );
            }
        }
    }

    return builder;
}
 
Example 14
Source File: AggregatedOffers.java    From storm with Apache License 2.0 4 votes vote down vote up
public Protos.SlaveID getSlaveID() {
  return slaveID;
}
 
Example 15
Source File: SlaveLostEvent.java    From incubator-myriad with Apache License 2.0 4 votes vote down vote up
public void setSlaveId(Protos.SlaveID slaveId) {
  this.slaveId = slaveId;
}
 
Example 16
Source File: IgniteSchedulerSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public Protos.Status sendFrameworkMessage(Protos.ExecutorID executorId, Protos.SlaveID slaveId,
    byte[] data) {
    return null;
}
 
Example 17
Source File: HelloWorldScheduler.java    From tutorials with MIT License 2 votes vote down vote up
@Override
public void executorLost(SchedulerDriver schedulerDriver, Protos.ExecutorID executorID, Protos.SlaveID slaveID, int i) {

}
 
Example 18
Source File: AbstractSimulatedMesosSchedulerDriverTest.java    From titus-control-plane with Apache License 2.0 2 votes vote down vote up
@Override
public void slaveLost(SchedulerDriver driver, Protos.SlaveID slaveId) {

}
 
Example 19
Source File: MesosWorkerStore.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Transition the worker to a launched state.
 * @return a new worker instance (does not mutate the current instance).
 */
public Worker launchWorker(Protos.SlaveID slaveID, String hostname) {
	return new Worker(taskID, profile, Option.apply(slaveID), Option.apply(hostname), WorkerState.Launched);
}
 
Example 20
Source File: MesosWorkerStore.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Transition the worker to a launched state.
 * @return a new worker instance (does not mutate the current instance).
 */
public Worker launchWorker(Protos.SlaveID slaveID, String hostname) {
	return new Worker(taskID, workerResourceSpec, Option.apply(slaveID), Option.apply(hostname), WorkerState.Launched);
}