use of io.kestra.core.models.executions.NextTaskRun in project kestra by kestra-io.
the class ExecutorService method saveFlowableOutput.
private List<TaskRun> saveFlowableOutput(List<NextTaskRun> nextTaskRuns, Executor executor, TaskRun parentTaskRun) {
return nextTaskRuns.stream().map(throwFunction(t -> {
TaskRun taskRun = t.getTaskRun();
if (!(t.getTask() instanceof FlowableTask)) {
return taskRun;
}
FlowableTask<?> flowableTask = (FlowableTask<?>) t.getTask();
try {
RunContext runContext = runContextFactory.of(executor.getFlow(), t.getTask(), executor.getExecution(), t.getTaskRun());
taskRun = taskRun.withOutputs(flowableTask.outputs(runContext, executor.getExecution(), parentTaskRun) != null ? flowableTask.outputs(runContext, executor.getExecution(), parentTaskRun).toMap() : ImmutableMap.of());
} catch (Exception e) {
executor.getFlow().logger().warn("Unable to save output on taskRun '{}'", taskRun, e);
}
return taskRun;
})).collect(Collectors.toList());
}
use of io.kestra.core.models.executions.NextTaskRun in project kestra by kestra-io.
the class ExecutorService method childNextsTaskRun.
private List<TaskRun> childNextsTaskRun(Executor executor, TaskRun parentTaskRun) throws InternalException {
Task parent = executor.getFlow().findTaskByTaskId(parentTaskRun.getTaskId());
if (parent instanceof FlowableTask) {
FlowableTask<?> flowableParent = (FlowableTask<?>) parent;
List<NextTaskRun> nexts = flowableParent.resolveNexts(runContextFactory.of(executor.getFlow(), parent, executor.getExecution(), parentTaskRun), executor.getExecution(), parentTaskRun);
if (nexts.size() > 0) {
return this.saveFlowableOutput(nexts, executor, parentTaskRun);
}
}
return new ArrayList<>();
}
Aggregations