Search in sources :

Example 91 with JPAExecutorException

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

the class BundleJobChangeXCommand method loadState.

@Override
protected void loadState() throws CommandException {
    try {
        this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB, bundleJob.getId());
        this.bundleActions = BundleActionQueryExecutor.getInstance().getList(BundleActionQuery.GET_BUNDLE_ACTIONS_STATUS_UNIGNORED_FOR_BUNDLE, bundleJob.getId());
    } catch (JPAExecutorException Ex) {
        throw new CommandException(ErrorCode.E1311, this.jobId);
    }
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CommandException(org.apache.oozie.command.CommandException)

Example 92 with JPAExecutorException

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

the class BundleJobChangeXCommand method eagerLoadState.

@Override
protected void eagerLoadState() throws CommandException {
    try {
        this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_STATUS, jobId);
        LogUtils.setLogInfo(bundleJob);
    } catch (JPAExecutorException ex) {
        throw new CommandException(ex);
    }
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CommandException(org.apache.oozie.command.CommandException)

Example 93 with JPAExecutorException

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

the class BundleKillXCommand method updateBundleAction.

/**
 * Update bundle action
 *
 * @param action
 * @throws CommandException
 */
private void updateBundleAction(BundleActionBean action) {
    action.setLastModifiedTime(new Date());
    if (!action.isTerminalStatus()) {
        action.incrementAndGetPending();
        action.setStatus(Job.Status.KILLED);
    } else {
        // while coordinator is killed.
        if (action.isPending()) {
            if (action.getCoordId() == null) {
                action.setPending(0);
            } else {
                try {
                    CoordinatorJobBean coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, action.getCoordId());
                    if (!coordJob.isPending() && coordJob.isTerminalStatus()) {
                        action.setPending(0);
                        action.setStatus(coordJob.getStatus());
                    }
                } catch (JPAExecutorException e) {
                    LOG.warn("Error in checking coord job status:" + action.getCoordId(), e);
                }
            }
        }
    }
    updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, action));
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) BundleActionQuery(org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery) Date(java.util.Date)

Example 94 with JPAExecutorException

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

the class BundleStatusTransitXCommand method loadState.

@Override
protected void loadState() throws CommandException {
    try {
        bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_ID_STATUS_PENDING_MOD_PAUSE_SUSPEND_TIME, jobId);
        bundleActions = BundleActionQueryExecutor.getInstance().getList(BundleActionQuery.GET_BUNDLE_UNIGNORED_ACTION_STATUS_PENDING_FOR_BUNDLE, jobId);
        for (BundleActionBean bAction : bundleActions) {
            int counter = 0;
            if (bundleActionStatus.containsKey(bAction.getStatus())) {
                counter = getActionStatusCount(bAction.getStatus()) + 1;
            } else {
                ++counter;
            }
            bundleActionStatus.put(bAction.getStatus(), counter);
            if (bAction.getCoordId() == null && (bAction.getStatus() == Job.Status.FAILED || bAction.getStatus() == Job.Status.KILLED)) {
                new BundleKillXCommand(jobId).call();
                bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_ID_STATUS_PENDING_MOD_PAUSE_SUSPEND_TIME, jobId);
                bundleJob.setStatus(Job.Status.FAILED);
                bundleJob.setLastModifiedTime(new Date());
                BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS, bundleJob);
            }
            if (bAction.isPending()) {
                LOG.debug(bAction + " has pending flag set");
                foundPending = true;
            }
        }
        LogUtils.setLogInfo(bundleJob);
    } catch (JPAExecutorException e) {
        throw new CommandException(ErrorCode.E1322, e);
    }
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CommandException(org.apache.oozie.command.CommandException) BundleActionBean(org.apache.oozie.BundleActionBean) Date(java.util.Date)

Example 95 with JPAExecutorException

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

the class CoordPushDependencyCheckXCommand method loadState.

@Override
protected void loadState() throws CommandException {
    jpaService = Services.get().get(JPAService.class);
    try {
        coordAction = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(actionId));
        if (coordAction != null) {
            coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordAction.getJobId()));
            LogUtils.setLogInfo(coordAction);
        } else {
            throw new CommandException(ErrorCode.E0605, actionId);
        }
    } catch (JPAExecutorException je) {
        throw new CommandException(je);
    }
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordJobGetJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor) CoordActionGetForInputCheckJPAExecutor(org.apache.oozie.executor.jpa.CoordActionGetForInputCheckJPAExecutor) CommandException(org.apache.oozie.command.CommandException) JPAService(org.apache.oozie.service.JPAService)

Aggregations

JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)195 JPAService (org.apache.oozie.service.JPAService)137 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)65 CommandException (org.apache.oozie.command.CommandException)63 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)55 Date (java.util.Date)53 CoordJobGetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor)49 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)45 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)43 CoordActionGetJPAExecutor (org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor)37 WorkflowJobGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor)33 WorkflowActionGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor)31 IOException (java.io.IOException)26 BundleJobBean (org.apache.oozie.BundleJobBean)24 CoordJobInsertJPAExecutor (org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor)19 BundleActionBean (org.apache.oozie.BundleActionBean)18 Configuration (org.apache.hadoop.conf.Configuration)15 BundleJobGetJPAExecutor (org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor)15 BundleActionGetJPAExecutor (org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor)14 XConfiguration (org.apache.oozie.util.XConfiguration)14