private CompletableFuture<Boolean> handleStatusUpdateAsync(TaskStatus status) { long start = System.currentTimeMillis(); return statusUpdateHandler.processStatusUpdateAsync(status) .whenCompleteAsync((result, throwable) -> { if (throwable != null) { LOG.error("Scheduler threw an uncaught exception processing status updates", throwable); notifyStopping(); abort.abort(AbortReason.UNRECOVERABLE_ERROR, Optional.of(throwable)); } if (status.hasUuid()) { mesosSchedulerClient.acknowledge(status.getAgentId(), status.getTaskId(), status.getUuid()); } LOG.debug("Handled status update for {} in {}", status.getTaskId().getValue(), JavaUtils.duration(start)); }); } }
.map(event -> event.getUpdate().getStatus()) .filter(status -> { if (!status.hasAgentId() || !status.getAgentId().hasValue()) { LOG.warn("Filtering out status update without agentId {}", status); return false;
private CompletableFuture<Boolean> handleStatusUpdateAsync(TaskStatus status) { long start = System.currentTimeMillis(); return statusUpdateHandler.processStatusUpdateAsync(status) .whenCompleteAsync((result, throwable) -> { if (throwable != null) { LOG.error("Scheduler threw an uncaught exception processing status updates", throwable); notifyStopping(); abort.abort(AbortReason.UNRECOVERABLE_ERROR, Optional.of(throwable)); } if (status.hasUuid()) { mesosSchedulerClient.acknowledge(status.getAgentId(), status.getTaskId(), status.getUuid()); } LOG.debug("Handled status update for {} in {}", status.getTaskId().getValue(), JavaUtils.duration(start)); }); } }
.map(event -> event.getUpdate().getStatus()) .filter(status -> { if (!status.hasAgentId() || !status.getAgentId().hasValue()) { LOG.warn("Filtering out status update without agentId {}", status); return false;
.map((Tuple2<Event, State<FrameworkID, TaskID, TaskState>> t) -> { final TaskStatus status = t._1.getUpdate().getStatus(); return SchedulerCalls.ackUpdate(t._2.getFwId(), status.getUuid(), status.getAgentId(), status.getTaskId()); }) .map(SinkOperations::create)
private synchronized void handleCompletedTaskState(TaskStatus status, SingularityTaskId taskIdObj, ExtendedTaskState taskState, SingularityCreateResult taskHistoryUpdateCreateResult, Optional<SingularityTask> task, long timestamp, boolean isActiveTask) { // Method synchronized to prevent race condition where two tasks complete at the same time but the leader cache holding the state // doesn't get updated between each task completion. If this were to happen, then slaves would never transition from DECOMMISSIONING to // DECOMMISSIONED because each task state check thinks the other task is still running. slaveAndRackManager.checkStateAfterFinishedTask(taskIdObj, status.getAgentId().getValue(), leaderCache); scheduler.handleCompletedTask(task, taskIdObj, isActiveTask, timestamp, taskState, taskHistoryUpdateCreateResult, status); }
private synchronized void handleCompletedTaskState(TaskStatus status, SingularityTaskId taskIdObj, ExtendedTaskState taskState, SingularityCreateResult taskHistoryUpdateCreateResult, Optional<SingularityTask> task, long timestamp, boolean isActiveTask) { // Method synchronized to prevent race condition where two tasks complete at the same time but the leader cache holding the state // doesn't get updated between each task completion. If this were to happen, then slaves would never transition from DECOMMISSIONING to // DECOMMISSIONED because each task state check thinks the other task is still running. slaveAndRackManager.checkStateAfterFinishedTask(taskIdObj, status.getAgentId().getValue(), leaderCache); scheduler.handleCompletedTask(task, taskIdObj, isActiveTask, timestamp, taskState, taskHistoryUpdateCreateResult, status); }