use of io.kestra.core.tasks.flows.Template in project kestra by kestra-io.
the class FlowJoinerTransformer method transform.
@Override
public Executor transform(String key, Executor executor) {
Flow flow;
try {
// pooling of new flow can be delayed on ExecutorStore, we maybe need to wait that the flow is updated
flow = Await.until(() -> flowExecutorInterface.findByExecution(executor.getExecution()).orElse(null), Duration.ofMillis(100), Duration.ofMinutes(5));
} catch (TimeoutException e) {
return executor.withException(new Exception("Unable to find flow with namespace: '" + executor.getExecution().getNamespace() + "'" + ", id: '" + executor.getExecution().getFlowId() + "', " + "revision '" + executor.getExecution().getFlowRevision() + "'"), "joinFlow");
}
if (!withDefaults) {
return executor.withFlow(flow);
}
try {
flow = Template.injectTemplate(flow, executor.getExecution(), (namespace, id) -> this.templateExecutorInterface.findById(namespace, id).orElse(null));
} catch (InternalException e) {
log.warn("Failed to inject template", e);
}
Flow flowWithDefaults = taskDefaultService.injectDefaults(flow, executor.getExecution());
return executor.withFlow(flowWithDefaults);
}
Aggregations