Search in sources :

Example 81 with JPAExecutorException

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

the class CoordRerunXCommand method loadState.

/* (non-Javadoc)
     * @see org.apache.oozie.command.XCommand#loadState()
     */
@Override
protected void loadState() throws CommandException {
    try {
        coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, jobId);
        prevPending = coordJob.isPending();
    } catch (JPAExecutorException je) {
        throw new CommandException(je);
    }
    LogUtils.setLogInfo(coordJob);
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CommandException(org.apache.oozie.command.CommandException)

Example 82 with JPAExecutorException

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

the class ActionCheckXCommand method loadState.

@Override
protected void loadState() throws CommandException {
    try {
        this.wfJob = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_ACTION_OP, jobId);
        this.wfAction = WorkflowActionQueryExecutor.getInstance().get(WorkflowActionQuery.GET_ACTION_CHECK, actionId);
    } catch (JPAExecutorException e) {
        throw new CommandException(e);
    }
    LogUtils.setLogInfo(wfJob);
    LogUtils.setLogInfo(wfAction);
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CommandException(org.apache.oozie.command.CommandException)

Example 83 with JPAExecutorException

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

the class BundleStartXCommand method startCoordJobs.

/**
 * Start Coord Jobs
 *
 * @throws CommandException thrown if failed to start coord jobs
 */
@SuppressWarnings("unchecked")
private void startCoordJobs() throws CommandException {
    if (bundleJob != null) {
        try {
            Element bAppXml = XmlUtils.parseXml(bundleJob.getJobXml());
            List<Element> coordElems = bAppXml.getChildren("coordinator", bAppXml.getNamespace());
            for (Element coordElem : coordElems) {
                Attribute name = coordElem.getAttribute("name");
                Configuration coordConf = mergeConfig(coordElem);
                coordConf.set(OozieClient.BUNDLE_ID, jobId);
                if (OozieJobInfo.isJobInfoEnabled()) {
                    coordConf.set(OozieJobInfo.BUNDLE_NAME, bundleJob.getAppName());
                }
                // skip coord job if it is not enabled
                if (!isEnabled(coordElem, coordConf)) {
                    continue;
                }
                String coordName = name.getValue();
                try {
                    coordName = ELUtils.resolveAppName(coordName, coordConf);
                } catch (Exception e) {
                    throw new CommandException(ErrorCode.E1321, e.getMessage(), e);
                }
                queue(new BundleCoordSubmitXCommand(coordConf, bundleJob.getId(), name.getValue()));
            }
            updateBundleAction();
        } catch (JDOMException jex) {
            throw new CommandException(ErrorCode.E1301, jex.getMessage(), jex);
        } catch (JPAExecutorException je) {
            throw new CommandException(je);
        }
    } else {
        throw new CommandException(ErrorCode.E0604, jobId);
    }
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) XConfiguration(org.apache.oozie.util.XConfiguration) Configuration(org.apache.hadoop.conf.Configuration) Attribute(org.jdom.Attribute) Element(org.jdom.Element) CommandException(org.apache.oozie.command.CommandException) JDOMException(org.jdom.JDOMException) JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) JDOMException(org.jdom.JDOMException) IOException(java.io.IOException) XException(org.apache.oozie.XException) CommandException(org.apache.oozie.command.CommandException) PreconditionException(org.apache.oozie.command.PreconditionException)

Example 84 with JPAExecutorException

use of org.apache.oozie.executor.jpa.JPAExecutorException 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;
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) ArrayList(java.util.ArrayList) WorkflowActionGetJPAExecutor(org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor) CommandException(org.apache.oozie.command.CommandException) WorkflowActionBean(org.apache.oozie.WorkflowActionBean) CoordinatorWfActionBean(org.apache.oozie.CoordinatorWfActionBean)

Example 85 with JPAExecutorException

use of org.apache.oozie.executor.jpa.JPAExecutorException 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);
    }
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) CommandException(org.apache.oozie.command.CommandException)

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