use of org.apache.oozie.command.CommandException in project oozie by apache.
the class BundleStartXCommand method loadState.
@Override
public void loadState() throws CommandException {
try {
this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB, jobId);
LogUtils.setLogInfo(bundleJob);
super.setJob(bundleJob);
} catch (XException ex) {
throw new CommandException(ex);
}
}
use of org.apache.oozie.command.CommandException in project oozie by apache.
the class BundleStatusUpdateXCommand method execute.
@Override
protected Void execute() throws CommandException {
try {
LOG.debug("STARTED BundleStatusUpdateXCommand with bundle id : " + coordjob.getBundleId() + " coord job ID: " + coordjob.getId() + " coord Status " + coordjob.getStatus());
Job.Status coordCurrentStatus = coordjob.getStatus();
// should not be changed.
if (bundleaction.getCoordId() != null || !bundleaction.isTerminalStatus() || (bundleaction.getCoordId() != null && bundleaction.isTerminalStatus() && coordjob.isTerminalStatus())) {
bundleaction.setStatus(coordCurrentStatus);
}
if (bundleaction.isPending() && !ignorePending) {
bundleaction.decrementAndGetPending();
}
// TODO - Uncomment this when bottom up rerun can change terminal state
/*BundleJobBean bundleJob = jpaService.execute(new BundleJobGetJPAExecutor(bundleaction.getBundleId()));
if (!bundleJob.isPending()) {
bundleJob.setPending();
jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
LOG.info("Updated bundle job [{0}] pending to true", bundleaction.getBundleId());
}*/
bundleaction.setLastModifiedTime(new Date());
bundleaction.setCoordId(coordjob.getId());
BundleActionQueryExecutor.getInstance().executeUpdate(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID, bundleaction);
if (bundleaction.getCoordId() != null) {
LOG.info("Updated bundle action [{0}] from prev status [{1}] to current coord status [{2}], " + "and new bundle action pending [{3}]", bundleaction.getBundleActionId(), bundleaction.getStatus(), coordCurrentStatus, bundleaction.getPending());
} else {
LOG.info("Updated Bundle action [{0}], status = [{1}], pending = [{2}]", bundleaction.getBundleActionId(), bundleaction.getStatus(), bundleaction.getPending());
}
LOG.debug("ENDED BundleStatusUpdateXCommand with bundle id : " + coordjob.getBundleId() + " coord job ID: " + coordjob.getId() + " coord Status " + coordjob.getStatus());
} catch (Exception ex) {
throw new CommandException(ErrorCode.E1309, bundleaction.getBundleId(), bundleaction.getCoordName());
}
return null;
}
use of org.apache.oozie.command.CommandException in project oozie by apache.
the class CoordWfActionInfoXCommand method execute.
@Override
protected List<CoordinatorWfActionBean> execute() throws CommandException {
List<CoordinatorWfActionBean> coordWfActions = new ArrayList<CoordinatorWfActionBean>();
for (CoordinatorActionBean coordAction : coordActions) {
String wfId = coordAction.getExternalId();
String nullReason = null;
WorkflowActionBean wfAction = null;
if (wfId != null) {
String wfActionId = wfId + "@" + actionName;
try {
wfAction = jpaService.execute(new WorkflowActionGetJPAExecutor(wfActionId, true));
if (wfAction == null) {
nullReason = CoordinatorWfAction.NullReason.ACTION_NULL.getNullReason(actionName, wfId);
}
} catch (JPAExecutorException ex) {
throw new CommandException(ex);
}
} else {
nullReason = CoordinatorWfAction.NullReason.PARENT_NULL.getNullReason();
LOG.warn(nullReason);
wfAction = null;
}
int actionNumber = coordAction.getActionNumber();
CoordinatorWfActionBean coordWfAction = new CoordinatorWfActionBean(actionNumber, wfAction, nullReason);
coordWfActions.add(coordWfAction);
}
return coordWfActions;
}
use of org.apache.oozie.command.CommandException in project oozie by apache.
the class SLAEventsXCommand method execute.
@Override
protected List<SLAEventBean> execute() throws CommandException {
try {
JPAService jpaService = Services.get().get(JPAService.class);
List<SLAEventBean> slaEventList = null;
long[] lastSeqId = new long[1];
if (jpaService != null) {
slaEventList = jpaService.execute(new SLAEventsGetForFilterJPAExecutor(seqId, maxNoEvents, filter, lastSeqId));
} else {
LOG.error(ErrorCode.E0610);
}
setLastSeqId(lastSeqId[0]);
return slaEventList;
} catch (XException ex) {
throw new CommandException(ex);
}
}
use of org.apache.oozie.command.CommandException in project oozie by apache.
the class SLACoordActionJobEventXCommand method loadState.
@Override
protected void loadState() throws CommandException {
try {
ca = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION_FOR_SLA, slaCalc.getId());
if (ca.getExternalId() != null) {
wf = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_FOR_SLA, ca.getExternalId());
}
LogUtils.setLogInfo(ca);
} catch (JPAExecutorException e) {
throw new CommandException(e);
}
}
Aggregations