Orch: update intermediate output fetching process to FAILED if fails to launch
@@ -47,6 +47,7 @@ import org.apache.airavata.model.messaging.event.*;
import org.apache.airavata.model.process.ProcessModel;
import org.apache.airavata.model.status.ExperimentState;
import org.apache.airavata.model.status.ExperimentStatus;
+import org.apache.airavata.model.status.ProcessState;
import org.apache.airavata.model.status.ProcessStatus;
import org.apache.airavata.model.task.TaskTypes;
import org.apache.airavata.model.util.ExperimentModelUtil;
@@ -381,6 +382,8 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
processModel.setProcessOutputs(requestedOutputs);
String processId = registryClient.addProcess(processModel, experimentId);
processModel.setProcessId(processId);
+
+ try {
// Find the process that is responsible for main experiment workflow by
// looking for the process that has the JOB_SUBMISSION task
Optional<ProcessModel> jobSubmissionProcess = experimentModel.getProcesses().stream()
@@ -420,8 +423,18 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
throw new Exception("You have not configured credential store token at group resource profile or compute resource preference." +
" Please provide the correct token at group resource profile or compute resource preference.");
}
- // TODO: handle errors by updating the PROCESS status
orchestrator.launchProcess(processModel, token);
+ } catch (Exception e) {
+ log.error("Failed to launch process for intermediate output fetching", e);
+
+ // Update Process status to FAILED
+ ProcessStatus status = new ProcessStatus(ProcessState.FAILED);
+ status.setReason("Intermediate output fetching process failed to launch: " + e.getMessage());
+ status.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
+ registryClient.addProcessStatus(status, processId);
+
+ throw e;
+ }
}
private String getAiravataUserName() {
