Search in sources :

Example 1 with CoordJobGetActionsSuspendedJPAExecutor

use of org.apache.oozie.executor.jpa.CoordJobGetActionsSuspendedJPAExecutor in project oozie by apache.

the class CoordResumeXCommand method resumeChildren.

@Override
public void resumeChildren() throws CommandException {
    try {
        // Get all suspended actions to resume them
        List<CoordinatorActionBean> actionList = jpaService.execute(new CoordJobGetActionsSuspendedJPAExecutor(jobId));
        for (CoordinatorActionBean action : actionList) {
            if (action.getExternalId() != null) {
                // queue a ResumeXCommand
                queue(new ResumeXCommand(action.getExternalId()));
                updateCoordAction(action);
                LOG.debug("Resume coord action = [{0}], new status = [{1}], pending = [{2}] and queue ResumeXCommand for [{3}]", action.getId(), action.getStatus(), action.getPending(), action.getExternalId());
            } else {
                updateCoordAction(action);
                LOG.debug("Resume coord action = [{0}], new status = [{1}], pending = [{2}] and external id is null", action.getId(), action.getStatus(), action.getPending());
            }
        }
    } catch (XException ex) {
        exceptionOccured = true;
        throw new CommandException(ex);
    } finally {
        if (exceptionOccured) {
            coordJob.setStatus(CoordinatorJob.Status.FAILED);
            coordJob.resetPending();
            LOG.warn("Resume children failed so fail coordinator, coordinator job id = " + jobId + ", status = " + coordJob.getStatus());
            updateList.add(new UpdateEntry<CoordJobQuery>(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING_TIME, coordJob));
        }
    }
}
Also used : CoordJobGetActionsSuspendedJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetActionsSuspendedJPAExecutor) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) XException(org.apache.oozie.XException) ResumeXCommand(org.apache.oozie.command.wf.ResumeXCommand) CommandException(org.apache.oozie.command.CommandException) CoordJobQuery(org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery)

Aggregations

CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)1 XException (org.apache.oozie.XException)1 CommandException (org.apache.oozie.command.CommandException)1 ResumeXCommand (org.apache.oozie.command.wf.ResumeXCommand)1 CoordJobGetActionsSuspendedJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetActionsSuspendedJPAExecutor)1 CoordJobQuery (org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery)1