Java Code Examples for org.apache.mesos.Protos.TaskState#TASK_LOST
The following examples show how to use
org.apache.mesos.Protos.TaskState#TASK_LOST .
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: MesosSchedulerCallbackHandler.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Override public void statusUpdate(final SchedulerDriver arg0, TaskStatus taskStatus) { try { String taskId = taskStatus.getTaskId().getValue(); TaskState taskState = taskStatus.getState(); TaskStatus effectiveTaskStatus = taskStatusUpdateFitInjection.map(i -> i.afterImmediate("update", taskStatus)).orElse(taskStatus); if (isReconcilerUpdateForUnknownTask(effectiveTaskStatus)) { if (taskStatus.getState() == TaskState.TASK_LOST) { logger.info("Ignoring reconciler TASK_LOST status update for task: {}", taskId); return; } mesosStateTracker.unknownTaskStatusUpdate(taskStatus); if (!mesosConfiguration.isAllowReconcilerUpdatesForUnknownTasks()) { logger.info("Ignoring reconciler triggered task status update: {}", taskId); return; } } else { mesosStateTracker.knownTaskStatusUpdate(taskStatus); } logMesosCallbackInfo("Task status update: taskId=%s, taskState=%s, message=%s", taskId, taskState, effectiveTaskStatus.getMessage()); v3StatusUpdate(effectiveTaskStatus); } catch (Exception e) { logger.error("Unexpected error when handling the status update: {}", taskStatus, e); throw e; } }
Example 2
Source File: MesosSchedulerCallbackHandler.java From titus-control-plane with Apache License 2.0 | 5 votes |
private TaskState getEffectiveState(String taskId, TaskState taskState, TaskState previous) { TaskState effectiveState; if (previous != null && isTerminal(previous) && taskState == TaskState.TASK_LOST) { effectiveState = previous; // Replace task status only once (as we cannot remove item from cache, we overwrite the value) lastStatusUpdate.put(taskId, taskState); } else { effectiveState = taskState; lastStatusUpdate.put(taskId, taskState); } return effectiveState; }
Example 3
Source File: SingularityExecutor.java From Singularity with Apache License 2.0 | 4 votes |
/** * Invoked when a task has been launched on this executor (initiated * via Scheduler::launchTasks). Note that this task can be realized * with a thread, a process, or some simple computation, however, no * other callbacks will be invoked on this executor until this * callback has returned. */ @Override public void launchTask( final ExecutorDriver executorDriver, final Protos.TaskInfo taskInfo ) { final String taskId = taskInfo.getTaskId().getValue(); LOG.info("Asked to launch task {}", taskId); try { final ch.qos.logback.classic.Logger taskLog = taskBuilder.buildTaskLogger( taskId, taskInfo.getExecutor().getExecutorId().getValue() ); final SingularityExecutorTask task = taskBuilder.buildTask( taskId, executorDriver, taskInfo, taskLog ); SubmitState submitState = monitor.submit(task); switch (submitState) { case REJECTED: LOG.warn( "Can't launch task {}, it was rejected (probably due to shutdown)", taskInfo ); break; case TASK_ALREADY_EXISTED: LOG.error("Can't launch task {}, already had a task with that ID", taskInfo); break; case SUBMITTED: task .getLog() .info("Launched task {} with data {}", taskId, task.getExecutorData()); break; } } catch (Throwable t) { LOG.error("Unexpected exception starting task {}", taskId, t); TaskState state = t instanceof ArtifactVerificationException ? TaskState.TASK_FAILED : TaskState.TASK_LOST; executorUtils.sendStatusUpdate( executorDriver, taskInfo.getTaskId(), state, String.format( "Unexpected exception while launching task %s - %s", taskId, t.getMessage() ), LOG ); } }