Update flow execution as failed if it was skipped due to concurrently running flow
Closes from jack-moseley/status-concurrent
@@ -247,6 +247,14 @@ public class Orchestrator implements SpecCatalogListener, Instrumentable {
_log.warn("Another instance of flowGroup: {}, flowName: {} running; Skipping flow execution since "
+ "concurrent executions are disabled for this flow.", flowGroup, flowName);
flowGauges.get(spec.getUri().toString()).setState(CompiledState.SKIPPED);
+
+ // Send FLOW_FAILED event
+ Map<String, String> flowMetadata = TimingEventUtils.getFlowMetadata((FlowSpec) spec);
+ flowMetadata.put(TimingEvent.METADATA_MESSAGE, "Flow failed because another instance is running and concurrent "
+ + "executions are disabled. Set flow.allowConcurrentExecution to true in the flow spec to change this behaviour.");
+ if (this.eventSubmitter.isPresent()) {
+ this.eventSubmitter.get().getTimingEvent(TimingEvent.FlowTimings.FLOW_FAILED).stop(flowMetadata);
+ }
return;
}
