@Override
public CancellableStage.Result cancel(Stage stage) {
String readableStageDetails = format("(stageId: %s, executionId: %s, context: %s)", stage.getId(), stage.getExecution().getId(), stage.getContext());
log.info(format("Cancelling stage %s", readableStageDetails));
try {
String executionId = (String) stage.getContext().get("executionId");
if (executionId != null) {
if (executionRepository == null) {
log.error(format("Stage %s could not be canceled w/o front50 enabled. Please set 'front50.enabled: true' in your orca config.", readableStageDetails));
} else {
Execution childPipeline = executionRepository.retrieve(PIPELINE, executionId);
if (!childPipeline.isCanceled()) {
executionRepository.cancel(stage.getExecution().getType(), executionId, "parent pipeline", null);
}
}
}
} catch (Exception e) {
log.error(format("Failed to cancel stage %s, e: %s", readableStageDetails, e.getMessage()), e);
}
return new CancellableStage.Result(stage, emptyMap());
}
}