use of pipelite.stage.executor.StageExecutorResult in project pipelite by enasequence.
the class CmdExecutor method execute.
@Override
public void execute(StageExecutorRequest request, StageExecutorResultCallback resultCallback) {
CmdRunner cmdRunner = CmdRunner.create(getExecutorParams());
StageExecutorResult result = cmdRunner.execute(cmd);
if (getExecutorParams().getPermanentErrors().contains(Ints.tryParse(result.getAttribute(EXIT_CODE)))) {
result.setPermanentError();
}
resultCallback.accept(result);
}
use of pipelite.stage.executor.StageExecutorResult in project pipelite by enasequence.
the class AbstractLsfExecutor method recoverJobUsingOutFile.
private static boolean recoverJobUsingOutFile(CmdRunner cmdRunner, JobResult jobResult, Map<String, LsfDescribeJobsCache.RequestContext> requestMap) {
String outFile = requestMap.get(jobResult.jobId).getOutFile();
StageExecutorResult executorResult = extractResultFromOutFile(cmdRunner, outFile);
if (executorResult != null) {
log.atInfo().log("Recovered job result from LSF output file " + outFile + " for job: " + jobResult.jobId);
jobResult.result = executorResult;
return true;
} else {
log.atWarning().log("Could not recover job result from LSF output file " + outFile + " for job: " + jobResult.jobId);
log.atWarning().log("Considering LSF job failed as could not extract result for job: " + jobResult.jobId);
jobResult.result = StageExecutorResult.error();
return false;
}
}
use of pipelite.stage.executor.StageExecutorResult in project pipelite by enasequence.
the class AwsBatchExecutor method poll.
@Override
protected StageExecutorResult poll(StageExecutorRequest request) {
String jobId = getJobId();
logContext(log.atFine(), request).log("Polling AWSBatch job result " + jobId);
StageExecutorResult result = describeJobs().getResult(jobId, getExecutorParams().getPermanentErrors());
if (result.isActive()) {
return StageExecutorResult.active();
}
if (isSaveLogFile(result)) {
// TODO: save log
}
return result;
}
use of pipelite.stage.executor.StageExecutorResult in project pipelite by enasequence.
the class LocalCmdRunnerTest method echo.
@Test
public void echo() {
LocalCmdRunner cmdRunner = new LocalCmdRunner(CmdExecutorParameters.builder().build());
StageExecutorResult result = cmdRunner.execute("echo test");
assertThat(result.isError()).isFalse();
assertThat(result.getAttribute(StageExecutorResultAttribute.EXIT_CODE)).isEqualTo("0");
assertThat(result.getStageLog()).startsWith("test");
}
use of pipelite.stage.executor.StageExecutorResult in project pipelite by enasequence.
the class LocalCmdRunnerTest method unknownCommand.
@Test
public void unknownCommand() {
LocalCmdRunner cmdRunner = new LocalCmdRunner(CmdExecutorParameters.builder().build());
StageExecutorResult result = cmdRunner.execute(PipeliteIdCreator.id());
assertThat(result.isError()).isTrue();
assertThat(result.getAttribute(StageExecutorResultAttribute.EXIT_CODE)).isNotEqualTo("0");
}
Aggregations