coordAction.setStatus(CoordinatorAction.Status.RUNNING);
coordAction.setExternalId(wfId);
coordAction.incrementAndGetPending();
//store.updateCoordinatorAction(coordAction);
JPAService jpaService = Services.get().get(JPAService.class);
if (jpaService != null) {
log.debug("Updating WF record for WFID :" + wfId + " with parent id: " + actionId);
WorkflowJobBean wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(wfId));
wfJob.setParentId(actionId);
jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateForStartJPAExecutor(coordAction));
}
else {
log.error(ErrorCode.E0610);
}
makeFail = false;
}
catch (DagEngineException dee) {
errMsg = dee.getMessage();
errCode = "E1005";
log.warn("can not create DagEngine for submitting jobs", dee);
}
catch (CommandException ce) {
errMsg = ce.getMessage();
errCode = ce.getErrorCode().toString();
log.warn("command exception occured ", ce);
}
catch (java.io.IOException ioe) {
errMsg = ioe.getMessage();
errCode = "E1005";
log.warn("Configuration parse error. read from DB :" + coordAction.getRunConf(), ioe);
}
catch (Exception ex) {
errMsg = ex.getMessage();
errCode = "E1005";
log.warn("can not create DagEngine for submitting jobs", ex);
}
finally {
if (makeFail == true) { // No DB exception occurs
log.warn("Failing the action " + coordAction.getId() + ". Because " + errCode + " : " + errMsg);
coordAction.setStatus(CoordinatorAction.Status.FAILED);
if (errMsg.length() > 254) { // Because table column size is 255
errMsg = errMsg.substring(0, 255);
}
coordAction.setErrorMessage(errMsg);
coordAction.setErrorCode(errCode);
JPAService jpaService = Services.get().get(JPAService.class);
if (jpaService != null) {
try {
jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateForStartJPAExecutor(coordAction));
}
catch (JPAExecutorException je) {
throw new CommandException(je);
}
}