.getType());
wfAction.setErrorInfo(EXEC_DATA_MISSING,
"Execution Complete, but Execution Data Missing from Action");
failJob(context);
jpaService.execute(new WorkflowActionUpdateJPAExecutor(wfAction));
jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
return null;
}
wfAction.setPending();
queue(new ActionEndXCommand(wfAction.getId(), wfAction.getType()));
}
else {
if (!context.isStarted()) {
LOG.warn(XLog.OPS, "Action Started, ActionExecutor [{0}] must call setStartData()", executor
.getType());
wfAction.setErrorInfo(START_DATA_MISSING, "Execution Started, but Start Data Missing from Action");
failJob(context);
jpaService.execute(new WorkflowActionUpdateJPAExecutor(wfAction));
jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
return null;
}
queue(new NotificationXCommand(wfJob, wfAction));
}
LOG.warn(XLog.STD, "[***" + wfAction.getId() + "***]" + "Action status=" + wfAction.getStatusStr());
jpaService.execute(new WorkflowActionUpdateJPAExecutor(wfAction));
jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
// Add SLA status event (STARTED) for WF_ACTION
SLADbXOperations.writeStausEvent(wfAction.getSlaXml(), wfAction.getId(), Status.STARTED,
SlaAppType.WORKFLOW_ACTION);
LOG.warn(XLog.STD, "[***" + wfAction.getId() + "***]" + "Action updated in DB!");
}
catch (ActionExecutorException ex) {
LOG.warn("Error starting action [{0}]. ErrorType [{1}], ErrorCode [{2}], Message [{3}]",
wfAction.getName(), ex.getErrorType(), ex.getErrorCode(), ex.getMessage(), ex);
wfAction.setErrorInfo(ex.getErrorCode(), ex.getMessage());
switch (ex.getErrorType()) {
case TRANSIENT:
if (!handleTransient(context, executor, WorkflowAction.Status.START_RETRY)) {
handleNonTransient(context, executor, WorkflowAction.Status.START_MANUAL);
wfAction.setPendingAge(new Date());
wfAction.setRetries(0);
wfAction.setStartTime(null);
}
break;
case NON_TRANSIENT:
handleNonTransient(context, executor, WorkflowAction.Status.START_MANUAL);
break;
case ERROR:
handleError(context, executor, WorkflowAction.Status.ERROR.toString(), true,
WorkflowAction.Status.DONE);
break;
case FAILED:
try {
failJob(context);
// update coordinator action
new CoordActionUpdateXCommand(wfJob, 3).call();
new WfEndXCommand(wfJob).call(); // To delete the WF temp dir
SLADbXOperations.writeStausEvent(wfAction.getSlaXml(), wfAction.getId(), Status.FAILED,
SlaAppType.WORKFLOW_ACTION);
SLADbXOperations.writeStausEvent(wfJob.getSlaXml(), wfJob.getId(), Status.FAILED,
SlaAppType.WORKFLOW_JOB);
}
catch (XException x) {
LOG.warn("ActionStartXCommand - case:FAILED ", x.getMessage());
}
break;
}
try {
jpaService.execute(new WorkflowActionUpdateJPAExecutor(wfAction));
jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
}
catch (JPAExecutorException je) {
throw new CommandException(je);
}
}