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();
assertEquals(String.format("/host/%s", task.getMesosTask().getTaskId().getValue()), task.getMesosTask().getContainer().getVolumes(1).getHostPath()); assertEquals(Mode.RO, task.getMesosTask().getContainer().getVolumes(1).getMode());
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)); }); } }
assertEquals(String.format("/host/%s", task.getMesosTask().getTaskId().getValue()), task.getMesosTask().getContainer().getVolumes(1).getHostPath()); assertEquals(Mode.RO, task.getMesosTask().getContainer().getVolumes(1).getMode());