use of org.apache.oozie.executor.jpa.CoordJobGetActionsRunningJPAExecutor in project oozie by apache.
the class CoordSuspendXCommand method suspendChildren.
@Override
public void suspendChildren() throws CommandException {
try {
// Get all running actions of a job to suspend them
List<CoordinatorActionBean> actionList = jpaService.execute(new CoordJobGetActionsRunningJPAExecutor(jobId));
for (CoordinatorActionBean action : actionList) {
// queue a SuspendXCommand
if (action.getExternalId() != null) {
queue(new SuspendXCommand(action.getExternalId()));
updateCoordAction(action);
LOG.debug("Suspend coord action = [{0}], new status = [{1}], pending = [{2}] and queue SuspendXCommand for [{3}]", action.getId(), action.getStatus(), action.getPending(), action.getExternalId());
} else {
updateCoordAction(action);
LOG.debug("Suspend coord action = [{0}], new status = [{1}], pending = [{2}] and external id is null", action.getId(), action.getStatus(), action.getPending());
}
}
LOG.debug("Suspended coordinator actions for the coordinator=[{0}]", jobId);
} catch (XException ex) {
exceptionOccured = true;
throw new CommandException(ex);
} finally {
if (exceptionOccured) {
coordJob.setStatus(CoordinatorJob.Status.FAILED);
coordJob.resetPending();
LOG.debug("Exception happened, fail coordinator job id = " + jobId + ", status = " + coordJob.getStatus());
updateList.add(new UpdateEntry<CoordJobQuery>(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING_TIME, coordJob));
}
}
}
Aggregations