public CompletableFuture<Boolean> processStatusUpdateAsync(Protos.TaskStatus status) { return statusUpdatesSemaphore.call(() -> CompletableFuture.supplyAsync(() -> { final String taskId = status.getTaskId().getValue(); final Optional<SingularityTaskId> maybeTaskId = getTaskId(taskId); if (!maybeTaskId.isPresent()) { return false; } schedulerLock.runWithRequestLock( () -> unsafeProcessStatusUpdate(status, maybeTaskId.get()), maybeTaskId.get().getRequestId(), getClass().getSimpleName() ); return true; }, statusUpdatesExecutor) ); } }
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)); }); } }
private void unsafeProcessStatusUpdate(Protos.TaskStatus status, SingularityTaskId taskIdObj) { final String taskId = status.getTaskId().getValue();
private void unsafeProcessStatusUpdate(Protos.TaskStatus status, SingularityTaskId taskIdObj) { final String taskId = status.getTaskId().getValue();
final State<FrameworkID, TaskID, TaskState> state = t._2; final TaskStatus status = event.getUpdate().getStatus(); state.put(status.getTaskId(), status.getState()); }) .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)
public CompletableFuture<Boolean> processStatusUpdateAsync(Protos.TaskStatus status) { return statusUpdatesSemaphore.call(() -> CompletableFuture.supplyAsync(() -> { final String taskId = status.getTaskId().getValue(); final Optional<SingularityTaskId> maybeTaskId = getTaskId(taskId); if (!maybeTaskId.isPresent()) { return false; } schedulerLock.runWithRequestLock( () -> unsafeProcessStatusUpdate(status, maybeTaskId.get()), maybeTaskId.get().getRequestId(), getClass().getSimpleName() ); return true; }, statusUpdatesExecutor) ); } }
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)); }); } }