Search in sources :

Example 1 with SingularityExecutorShellCommandRunner

use of com.hubspot.singularity.executor.shells.SingularityExecutorShellCommandRunner in project Singularity by HubSpot.

the class SingularityExecutorMesosFrameworkMessageHandler method handleShellRequest.

private void handleShellRequest(SingularityTaskShellCommandRequest shellRequest) {
    Optional<SingularityExecutorTask> matchingTask = monitor.getTask(shellRequest.getTaskId().getId());
    if (!matchingTask.isPresent()) {
        LOG.warn("Missing task for {}, ignoring shell request", shellRequest.getTaskId());
        return;
    }
    matchingTask.get().getLog().info("Received shell request {}", shellRequest);
    SingularityExecutorShellCommandUpdater updater = new SingularityExecutorShellCommandUpdater(objectMapper, shellRequest, matchingTask.get());
    Optional<SingularityExecutorTaskProcessCallable> taskProcess = monitor.getTaskProcess(shellRequest.getTaskId().getId());
    if (!taskProcess.isPresent()) {
        updater.sendUpdate(UpdateType.INVALID, Optional.of("No task process found"), Optional.<String>absent());
        return;
    }
    SingularityExecutorShellCommandRunner shellRunner = new SingularityExecutorShellCommandRunner(shellRequest, executorConfiguration, matchingTask.get(), taskProcess.get(), monitor.getShellCommandExecutorServiceForTask(shellRequest.getTaskId().getId()), updater);
    shellRunner.start();
}
Also used : SingularityExecutorTaskProcessCallable(com.hubspot.singularity.executor.task.SingularityExecutorTaskProcessCallable) SingularityExecutorShellCommandUpdater(com.hubspot.singularity.executor.shells.SingularityExecutorShellCommandUpdater) SingularityExecutorTask(com.hubspot.singularity.executor.task.SingularityExecutorTask) SingularityExecutorShellCommandRunner(com.hubspot.singularity.executor.shells.SingularityExecutorShellCommandRunner)

Aggregations

SingularityExecutorShellCommandRunner (com.hubspot.singularity.executor.shells.SingularityExecutorShellCommandRunner)1 SingularityExecutorShellCommandUpdater (com.hubspot.singularity.executor.shells.SingularityExecutorShellCommandUpdater)1 SingularityExecutorTask (com.hubspot.singularity.executor.task.SingularityExecutorTask)1 SingularityExecutorTaskProcessCallable (com.hubspot.singularity.executor.task.SingularityExecutorTaskProcessCallable)1