Package org.apache.oozie.command

Examples of org.apache.oozie.command.CommandException


                this.wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(wfId));
                this.actionList = jpaService.execute(new WorkflowActionsGetForJobJPAExecutor(wfId));
                LogUtils.setLogInfo(wfJob, logInfo);
            }
            else {
                throw new CommandException(ErrorCode.E0610);
            }
        }
        catch (XException ex) {
            throw new CommandException(ex);
        }
    }
View Full Code Here


            SLADbXOperations.writeStausEvent(wfJob.getSlaXml(), wfJob.getId(), Status.KILLED, SlaAppType.WORKFLOW_JOB);
            try {
                wfJob.getWorkflowInstance().kill();
            }
            catch (WorkflowException e) {
                throw new CommandException(ErrorCode.E0725, e.getMessage(), e);
            }
            WorkflowInstance wfInstance = wfJob.getWorkflowInstance();
            ((LiteWorkflowInstance) wfInstance).setStatus(WorkflowInstance.Status.KILLED);
            wfJob.setWorkflowInstance(wfInstance);
        }
        try {
            for (WorkflowActionBean action : actionList) {
                if (action.getStatus() == WorkflowActionBean.Status.RUNNING
                        || action.getStatus() == WorkflowActionBean.Status.DONE) {
                    action.setPending();
                    action.setStatus(WorkflowActionBean.Status.KILLED);

                    jpaService.execute(new WorkflowActionUpdateJPAExecutor(action));

                    queue(new ActionKillXCommand(action.getId(), action.getType()));
                }
                if (action.getStatus() == WorkflowActionBean.Status.PREP
                        || action.getStatus() == WorkflowActionBean.Status.START_RETRY
                        || action.getStatus() == WorkflowActionBean.Status.START_MANUAL
                        || action.getStatus() == WorkflowActionBean.Status.END_RETRY
                        || action.getStatus() == WorkflowActionBean.Status.END_MANUAL) {

                    action.setStatus(WorkflowActionBean.Status.KILLED);
                    action.resetPending();
                    SLADbXOperations.writeStausEvent(action.getSlaXml(), action.getId(), Status.KILLED,
                            SlaAppType.WORKFLOW_ACTION);
                    jpaService.execute(new WorkflowActionUpdateJPAExecutor(action));
                }
            }
            jpaService.execute(new WorkflowJobUpdateJPAExecutor(wfJob));
            queue(new NotificationXCommand(wfJob));
        }
        catch (JPAExecutorException je) {
            throw new CommandException(je);
        }
        finally {
            if(wfJob.getStatus() == WorkflowJob.Status.KILLED) {
                 new WfEndXCommand(wfJob).call(); //To delete the WF temp dir
            }
View Full Code Here

            coordAction.setLastModifiedTime(new Date());
            try {
                jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateForInputCheckJPAExecutor(coordAction));
            }
            catch (JPAExecutorException e) {
                throw new CommandException(e);
            }
            LOG.info("[" + actionId
                    + "]::ActionInputCheck:: nominal Time is newer than current time, so requeue and wait. Current="
                    + currentTime + ", nominal=" + nominalTime);

            return null;
        }

        StringBuilder actionXml = new StringBuilder(coordAction.getActionXml());
        Instrumentation.Cron cron = new Instrumentation.Cron();
        try {
            Configuration actionConf = new XConfiguration(new StringReader(coordAction.getRunConf()));
            cron.start();
            StringBuilder existList = new StringBuilder();
            StringBuilder nonExistList = new StringBuilder();
            StringBuilder nonResolvedList = new StringBuilder();
            CoordCommandUtils.getResolvedList(coordAction.getMissingDependencies(), nonExistList, nonResolvedList);

            LOG.info("[" + actionId + "]::CoordActionInputCheck:: Missing deps:" + nonExistList.toString() + " "
                    + nonResolvedList.toString());
            boolean status = checkInput(actionXml, existList, nonExistList, actionConf);
            coordAction.setLastModifiedTime(currentTime);
            coordAction.setActionXml(actionXml.toString());
            if (nonResolvedList.length() > 0 && status == false) {
                nonExistList.append(CoordCommandUtils.RESOLVED_UNRESOLVED_SEPARATOR).append(nonResolvedList);
            }
            coordAction.setMissingDependencies(nonExistList.toString());
            if (status == true) {
                coordAction.setStatus(CoordinatorAction.Status.READY);
                // pass jobID to the CoordActionReadyXCommand
                queue(new CoordActionReadyXCommand(coordAction.getJobId()), 100);
            }
            else {
                long waitingTime = (currentTime.getTime() - Math.max(coordAction.getNominalTime().getTime(), coordAction
                        .getCreatedTime().getTime()))
                        / (60 * 1000);
                int timeOut = coordAction.getTimeOut();
                if ((timeOut >= 0) && (waitingTime > timeOut)) {
                    queue(new CoordActionTimeOutXCommand(coordAction), 100);
                }
                else {
                    queue(new CoordActionInputCheckXCommand(coordAction.getId(), coordAction.getJobId()), getCoordInputCheckRequeueInterval());
                }
            }
            coordAction.setLastModifiedTime(new Date());
            jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateForInputCheckJPAExecutor(coordAction));
        }
        catch (Exception e) {
            throw new CommandException(ErrorCode.E1021, e.getMessage(), e);
        }
        cron.stop();

        return null;
    }
View Full Code Here

        // We need to make sure, this assumption is correct.
        Element outputList = eAction.getChild("output-events", eAction.getNamespace());
        if (outputList != null) {
            for (Element dEvent : (List<Element>) outputList.getChildren("data-out", eAction.getNamespace())) {
                if (dEvent.getChild("unresolved-instances", dEvent.getNamespace()) != null) {
                    throw new CommandException(ErrorCode.E1006, "coord:latest()/future()",
                            " not permitted in output-event ");
                }
            }
        }
        return true;
View Full Code Here

        try {
            coordAction = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(actionId));
            coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordAction.getJobId()));
        }
        catch (JPAExecutorException je) {
            throw new CommandException(je);
        }
        LogUtils.setLogInfo(coordAction, logInfo);
    }
View Full Code Here

        LOG.warn("Suspending Workflow Job id=" + id);
        try {
            SuspendXCommand.suspendJob(Services.get().get(JPAService.class), workflow, id, action.getId());
        }
        catch (Exception e) {
            throw new CommandException(ErrorCode.E0727, e.getMessage());
        }
        finally {
            // update coordinator action
            new CoordActionUpdateXCommand(workflow, 3).call();
        }
View Full Code Here

                queue(new NotificationXCommand(workflow, action));
                queue(new KillXCommand(workflow.getId()));
                InstrumentUtils.incrJobCounter(INSTR_FAILED_JOBS_COUNTER, 1, getInstrumentation());
            }
            catch (WorkflowException ex) {
                throw new CommandException(ex);
            }
        }
    }
View Full Code Here

        try {
            jobConf = new XConfiguration(new StringReader(coordJob.getConf()));
        }
        catch (IOException ioe) {
            LOG.warn("Configuration parse error. read from DB :" + coordJob.getConf(), ioe);
            throw new CommandException(ErrorCode.E1005, ioe);
        }
        String jobXml = coordJob.getJobXml();
        Element eJob = XmlUtils.parseXml(jobXml);
        Date actualTime = new Date();
        String actionXml = CoordCommandUtils.materializeOneInstance(jobId, dryrun, (Element) eJob.clone(), coordAction
View Full Code Here

     */
    @Override
    protected void loadState() throws CommandException {
        jpaService = Services.get().get(JPAService.class);
        if (jpaService == null) {
            throw new CommandException(ErrorCode.E0610);
        }
        try {
            coordJob = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
            prevPending = coordJob.isPending();
        }
        catch (JPAExecutorException je) {
            throw new CommandException(je);
        }
        LogUtils.setLogInfo(coordJob, logInfo);
    }
View Full Code Here

    @Override
    protected void verifyPrecondition() throws CommandException, PreconditionException {
        if (coordJob.getStatus() == CoordinatorJob.Status.KILLED
                || coordJob.getStatus() == CoordinatorJob.Status.FAILED) {
            LOG.info("CoordRerunXCommand is not able to run, job status=" + coordJob.getStatus() + ", jobid=" + jobId);
            throw new CommandException(ErrorCode.E1018,
                    "coordinator job is killed or failed so all actions are not eligible to rerun!");
        }

        // no actioins have been created for PREP job
        if (coordJob.getStatus() == CoordinatorJob.Status.PREP) {
            LOG.info("CoordRerunXCommand is not able to run, job status=" + coordJob.getStatus() + ", jobid=" + jobId);
            throw new CommandException(ErrorCode.E1018,
                    "coordinator job is PREP so no actions are materialized to rerun!");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.command.CommandException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.