本文整理汇总了Java中org.apache.mesos.Protos.ExecutorID类的典型用法代码示例。如果您正苦于以下问题:Java ExecutorID类的具体用法?Java ExecutorID怎么用?Java ExecutorID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecutorID类属于org.apache.mesos.Protos包,在下文中一共展示了ExecutorID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: frameworkMessage
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
@Override
public void frameworkMessage(SchedulerDriver driver, ExecutorID executorId, SlaveID slaveId, byte[] data) {
if (!isRunning()) {
LOG.info("Ignoring framework message because scheduler isn't running ({})", state);
return;
}
lock.lock();
try {
scheduler.frameworkMessage(driver, executorId, slaveId, data);
} catch (Throwable t) {
handleUncaughtSchedulerException(t);
} finally {
lock.unlock();
}
}
示例2: executorLost
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
@Override
public void executorLost(SchedulerDriver driver, ExecutorID executorId, SlaveID slaveId, int status) {
if (!isRunning()) {
LOG.info("Ignoring executor lost {} because scheduler isn't running ({})", executorId, state);
return;
}
lock.lock();
try {
scheduler.executorLost(driver, executorId, slaveId, status);
} catch (Throwable t) {
handleUncaughtSchedulerException(t);
} finally {
lock.unlock();
}
}
示例3: pack
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
/**
* Packs the TaskInfo in preparation for sending it to the Executor. For a description of how the packing works
* (and why it exists), see the class-level javadoc.
*
* @see #unpack(TaskInfo)
*/
public static TaskInfo pack(TaskInfo taskInfo) {
if (!taskInfo.hasExecutor()) {
return taskInfo;
} else {
ExecutorInfo.Builder executorInfoBuilder = ExecutorInfo.newBuilder()
.setExecutorId(ExecutorID.newBuilder().setValue(COMMAND_DATA_PACKAGE_EXECUTORID));
if (taskInfo.hasCommand()) {
executorInfoBuilder.setCommand(taskInfo.getCommand());
}
if (taskInfo.hasData()) {
executorInfoBuilder.setData(taskInfo.getData());
}
return TaskInfo.newBuilder(taskInfo)
.setData(executorInfoBuilder.build().toByteString())
.clearCommand()
.build();
}
}
示例4: executorLost
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
@Override
public void executorLost(final SchedulerDriver driver,
final Protos.ExecutorID executorId,
final Protos.SlaveID slaveId,
final int status) {
final String diagnostics = "Executor Lost. executorid: "+executorId.getValue()+" slaveid: "+slaveId.getValue();
final ResourceStatusEvent resourceStatus =
ResourceStatusEventImpl.newBuilder()
.setIdentifier(executorId.getValue())
.setState(State.FAILED)
.setExitCode(status)
.setDiagnostics(diagnostics)
.build();
this.reefEventHandlers.onResourceStatus(resourceStatus);
}
示例5: stopExecutors
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
private void stopExecutors(final String appName) {
try {
Collection<MesosStateService.ExecutorStateInfo> executorBriefInfo = mesosStateService.executors(appName);
for (MesosStateService.ExecutorStateInfo each : executorBriefInfo) {
producerManager.sendFrameworkMessage(ExecutorID.newBuilder().setValue(each.getId()).build(),
SlaveID.newBuilder().setValue(each.getSlaveId()).build(), "STOP".getBytes());
}
} catch (final JSONException ex) {
throw new JobSystemException(ex);
}
}
示例6: runActionOnPoll
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
@Override
public void runActionOnPoll() {
final long start = System.currentTimeMillis();
final List<SingularityTaskShellCommandRequest> shellRequests = taskManager.getAllQueuedTaskShellCommandRequests();
Optional<SchedulerDriver> driver = schedulerDriverSupplier.get();
if (!driver.isPresent()) {
LOG.warn("Unable to process shell requests because scheduler driver isn't present ({} tasks waiting)", shellRequests.size());
return;
}
if (shellRequests.isEmpty()) {
LOG.trace("No shell requests to send.");
return;
}
for (SingularityTaskShellCommandRequest shellRequest : shellRequests) {
Optional<SingularityTask> task = taskManager.getTask(shellRequest.getTaskId());
if (!task.isPresent() || !taskManager.isActiveTask(shellRequest.getTaskId().getId())) {
LOG.info("Skipping shell request {} because {} didn't exist or isn't active", shellRequest, shellRequest.getTaskId());
continue;
}
final ExecutorID executorId = task.get().getMesosTask().getExecutor().getExecutorId();
final SlaveID slaveId = task.get().getMesosTask().getSlaveId();
final byte[] bytes = transcoder.toBytes(shellRequest);
final Status status = driver.get().sendFrameworkMessage(executorId, slaveId, bytes);
LOG.info("Sent {} ({} bytes) to {} on {} ({})", shellRequest, bytes.length, executorId, slaveId, status);
taskManager.saveTaskShellCommandRequestToTask(shellRequest);
taskManager.deleteTaskShellCommandRequestFromQueue(shellRequest);
}
LOG.info("Sent {} shell requests to executors in {}", shellRequests.size(), JavaUtils.duration(start));
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:41,代码来源:SingularityTaskShellCommandDispatchPoller.java
示例7: executorLost
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
@Override
public void executorLost(SchedulerDriver schedulerDriver, ExecutorID executorID, SlaveID slaveID,
int status) {
log.warn("Lost executor " + executorID);
counters.get("scheduler_lost_executors").incrementAndGet();
}
示例8: frameworkMessage
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
@Timed("scheduler_framework_message")
@Override
public void frameworkMessage(
SchedulerDriver driver,
ExecutorID executorID,
SlaveID slave,
byte[] data) {
log.warn("Ignoring framework message.");
}
示例9: sendStatus
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
/**
* Invokes {@link #sendStatus(ExecutorDriver, TaskState, TaskID, SlaveID, ExecutorID, String, boolean)} with null
* {@code labels} and {@code data} values.
*/
public static void sendStatus(ExecutorDriver driver,
TaskState state,
TaskID taskID,
SlaveID slaveID,
ExecutorID executorID,
String message,
boolean isHealthy) {
sendStatus(driver, state, taskID, slaveID, executorID, message, isHealthy, null, null);
}
示例10: getTaskInfo
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
private Protos.TaskInfo getTaskInfo(Protos.SlaveID slaveID, final TaskAssignmentResult result) {
ProcessorTask t = (ProcessorTask) result.getRequest();
Protos.TaskID pTaskId = Protos.TaskID.newBuilder().setValue(t.getId()).build();
// DockerInfo docker = DockerInfo.newBuilder()
// .setImage(t.getProcessor().docker)
// .build();
//
// ContainerInfo container = ContainerInfo.newBuilder()
// .setDocker(docker)
// .setType(ContainerInfo.Type.DOCKER)
// .build();
ExecutorID eid = ExecutorID.newBuilder().setValue(t.getId()).build();
CommandInfo ci = CommandInfo.newBuilder().setValue(configuration.executorCommand).build();
ExecutorInfo executor = ExecutorInfo.newBuilder().setExecutorId(eid).setFrameworkId(frameworkId)
// .setContainer(container)
.setCommand(ci).build();
ByteString data = ByteString.copyFromUtf8(t.getMessage());
Label processorLabel = Label.newBuilder().setKey("processor").setValue(t.getProcessor().toJson())
.build();
Label messageLabel = Label.newBuilder().setKey("message").setValueBytes(data).build();
Labels labels = Labels.newBuilder().addLabels(processorLabel).addLabels(messageLabel).build();
return Protos.TaskInfo.newBuilder().setName("task " + pTaskId.getValue()).setTaskId(pTaskId).setSlaveId(slaveID)
.setLabels(labels).setData(data)
.addResources(Protos.Resource.newBuilder().setName("cpus").setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(t.getCPUs())))
.addResources(Protos.Resource.newBuilder().setName("mem").setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(t.getMemory())))
// .setContainer(container)
// .setCommand(Protos.CommandInfo.newBuilder().setShell(false))
.setExecutor(executor).build();
}
示例11: onEvent
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
@Override
public void onEvent(ExecutorLostEvent event, long sequence, boolean endOfBatch) throws Exception {
ExecutorID executorId = event.getExecutorId();
SlaveID slaveId = event.getSlaveId();
int exitStatus = event.getExitStatus();
LOGGER.info("Executor {} of slave {} lost with exit status: {}", executorId, slaveId, exitStatus);
}
示例12: getNodeTask
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
/**
* Returns a NodeTask given a ServiceResourceProfile and hostname
*
* @param hostName
* @param profile
* @return
*/
public static NodeTask getNodeTask(String hostName, ServiceResourceProfile profile) {
NodeTask task = new NodeTask(profile, new LikeConstraint(hostName, "host-[0-9]*.example.com"));
task.setHostname(hostName);
task.setTaskPrefix("nm");
task.setSlaveId(SlaveID.newBuilder().setValue(profile.getName() + "-" + hostName).build());
task.setExecutorInfo(ExecutorInfo.newBuilder().setExecutorId(ExecutorID.newBuilder().setValue("exec")).
setCommand(org.apache.mesos.Protos.CommandInfo.newBuilder().setValue("command")).build());
return task;
}
示例13: sendMessageTo
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
public void sendMessageTo(SchedulerDriver driver, TaskID taskId,
SlaveID slaveID, String message) {
log.info(String.format("Sending message '%s' to taskId=%s, slaveId=%s", message,
taskId.getValue(), slaveID.getValue()));
String postfix = taskId.getValue();
postfix = postfix.substring(postfix.indexOf('.') + 1, postfix.length());
postfix = postfix.substring(postfix.indexOf('.') + 1, postfix.length());
driver.sendFrameworkMessage(
ExecutorID.newBuilder().setValue("executor." + postfix).build(),
slaveID,
message.getBytes(Charset.defaultCharset()));
}
示例14: JesosExecutorDriver
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
public JesosExecutorDriver(final Executor executor) throws IOException
{
this(executor,
UPID.create(System.getenv("MESOS_SLAVE_PID")),
SlaveID.newBuilder().setValue(System.getenv("MESOS_SLAVE_ID")).build(),
FrameworkID.newBuilder().setValue(System.getenv("MESOS_FRAMEWORK_ID")).build(),
ExecutorID.newBuilder().setValue(System.getenv("MESOS_EXECUTOR_ID")).build());
}
示例15: sendFrameworkMessage
import org.apache.mesos.Protos.ExecutorID; //导入依赖的package包/类
@Override
public Status sendFrameworkMessage(final ExecutorID executorId, final SlaveID slaveId, final byte[] data)
{
checkNotNull(executorId, "executorId is null");
checkNotNull(slaveId, "slaveId is null");
checkNotNull(data, "data is null");
if (!context.isStateMachine(DRIVER_RUNNING)) {
return context.getStateMachine();
}
final FrameworkToExecutorMessage message = FrameworkToExecutorMessage.newBuilder()
.setFrameworkId(context.getFrameworkId())
.setExecutorId(executorId)
.setSlaveId(slaveId)
.setData(ByteString.copyFrom(data)).build();
// If the UPID of that slave is known (from the slave cache, then send the message
// directly to the slave, otherwise to the master and let the master sort it out.
if (context.containsSlave(message.getSlaveId())) {
final UPID slave = context.getSlaveUPID(message.getSlaveId());
eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), slave, message));
}
else {
eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), message));
}
return context.getStateMachine();
}