use of org.apache.mesos.Protos.TaskStatus in project storm-mesos by nathanmarz.
the class MesosSupervisor method killedWorker.
@Override
public void killedWorker(int port) {
try {
_state.remove(port);
} catch (IOException e) {
throw new RuntimeException(e);
}
TaskStatus status = TaskStatus.newBuilder().setState(TaskState.TASK_FINISHED).setTaskId(TaskID.newBuilder().setValue(MesosCommon.taskId(_assignmentId, port))).build();
_driver.sendStatusUpdate(status);
}
use of org.apache.mesos.Protos.TaskStatus in project incubator-myriad by apache.
the class MyriadExecutorAuxService method sendStatus.
private void sendStatus(ContainerId containerId, TaskState taskState) {
Protos.TaskID taskId = Protos.TaskID.newBuilder().setValue(YARN_CONTAINER_TASK_ID_PREFIX + containerId.toString()).build();
TaskStatus status = TaskStatus.newBuilder().setTaskId(taskId).setState(taskState).build();
driver.sendStatusUpdate(status);
LOGGER.debug("Sent status " + taskState + " for taskId " + taskId);
}
use of org.apache.mesos.Protos.TaskStatus in project incubator-myriad by apache.
the class MyriadExecutor method killTask.
@Override
public void killTask(ExecutorDriver driver, TaskID taskId) {
String taskIdString = taskId.toString();
LOGGER.debug("killTask received for taskId: " + taskIdString);
TaskStatus status;
if (!taskIdString.contains(MyriadExecutorAuxService.YARN_CONTAINER_TASK_ID_PREFIX)) {
// currently running
synchronized (containerIds) {
for (String containerId : containerIds) {
Protos.TaskID containerTaskId = Protos.TaskID.newBuilder().setValue(MyriadExecutorAuxService.YARN_CONTAINER_TASK_ID_PREFIX + containerId).build();
status = TaskStatus.newBuilder().setTaskId(containerTaskId).setState(TaskState.TASK_KILLED).build();
driver.sendStatusUpdate(status);
}
}
// Now kill the node manager task
status = TaskStatus.newBuilder().setTaskId(taskId).setState(TaskState.TASK_KILLED).build();
driver.sendStatusUpdate(status);
LOGGER.info("NodeManager shutdown after receiving KILL_TASK for taskId {}", taskIdString);
Runtime.getRuntime().exit(0);
} else {
status = TaskStatus.newBuilder().setTaskId(taskId).setState(TaskState.TASK_KILLED).build();
driver.sendStatusUpdate(status);
synchronized (containerIds) {
// Likely the container isn't in here, but just in case remove it.
if (containerIds.remove(taskIdString.substring(MyriadExecutorAuxService.YARN_CONTAINER_FULL_PREFIX.length(), taskIdString.length()))) {
LOGGER.debug("Removed taskId {} from containerIds", taskIdString);
}
}
LOGGER.debug("Killing " + taskId);
}
}
use of org.apache.mesos.Protos.TaskStatus in project incubator-myriad by apache.
the class MyriadExecutor method launchTask.
@Override
public void launchTask(final ExecutorDriver driver, final TaskInfo task) {
LOGGER.debug("launchTask received for taskId: " + task.getTaskId());
TaskStatus status = TaskStatus.newBuilder().setTaskId(task.getTaskId()).setState(TaskState.TASK_RUNNING).build();
driver.sendStatusUpdate(status);
}
use of org.apache.mesos.Protos.TaskStatus in project dcos-commons by mesosphere.
the class TaskStatusUtils method sendStatus.
/**
* Sends a {@link TaskStatus} to the provided {@code driver} which contains the provided information.
*/
public static void sendStatus(ExecutorDriver driver, TaskState state, TaskID taskID, SlaveID slaveID, ExecutorID executorID, String message, boolean isHealthy, Labels labels, byte[] data) {
final TaskStatus.Builder builder = TaskStatus.newBuilder().setState(state).setMessage(message).setTaskId(taskID).setSlaveId(slaveID).setExecutorId(executorID).setSource(TaskStatus.Source.SOURCE_EXECUTOR).setHealthy(isHealthy);
if (data != null) {
builder.setData(ByteString.copyFrom(data));
}
if (labels != null) {
builder.setLabels(labels);
}
try {
final TaskStatus taskStatus = builder.build();
LOGGER.info("Sending task status update: {}", TextFormat.shortDebugString(taskStatus));
driver.sendStatusUpdate(taskStatus);
} catch (Throwable t) {
LOGGER.error("Failed to build task status.", t);
}
}
Aggregations