Package org.apache.oozie.action

Examples of org.apache.oozie.action.ActionExecutor$Context


                return runningJob.isComplete();
            }
        });
        assertTrue(runningJob.isSuccessful());
        assertFalse(LauncherMapper.isMainSuccessful(runningJob));
        ActionExecutor ae = new JavaActionExecutor();
        ae.check(context, context.getAction());
        assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));
        assertEquals("FAILED/KILLED", context.getAction().getExternalStatus());
        assertEquals("1", context.getAction().getErrorCode());
        assertNull(context.getAction().getData());

        ae.end(context, context.getAction());
        assertEquals(WorkflowAction.Status.ERROR, context.getAction().getStatus());
    }
View Full Code Here


                return runningJob.isComplete();
            }
        });
        assertTrue(runningJob.isSuccessful());
        assertFalse(LauncherMapper.isMainSuccessful(runningJob));
        ActionExecutor ae = new JavaActionExecutor();
        ae.check(context, context.getAction());
        assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));
        assertEquals("FAILED/KILLED", context.getAction().getExternalStatus());
        assertNull(context.getAction().getData());

        ae.end(context, context.getAction());
        assertEquals(WorkflowAction.Status.ERROR, context.getAction().getStatus());
    }
View Full Code Here

                "<main-class>" + LauncherMainTester.class.getName() + "</main-class>" +
                "</java>";
        final Context context = createContext(actionXml);
        final RunningJob runningJob = submitAction(context);
        assertFalse(runningJob.isComplete());
        ActionExecutor ae = new JavaActionExecutor();
        ae.kill(context, context.getAction());
        assertEquals(WorkflowAction.Status.DONE, context.getAction().getStatus());
        assertEquals("KILLED", context.getAction().getExternalStatus());
        assertTrue(ae.isCompleted(context.getAction().getExternalStatus()));

        waitFor(60 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                return runningJob.isComplete();
            }
View Full Code Here

            public boolean evaluate() throws Exception {
                return runningJob2.isComplete();
            }
        });
        assertTrue(runningJob.isSuccessful());
        ActionExecutor ae = new JavaActionExecutor();
        ae.check(context, context.getAction());
        assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
        assertNull(context.getAction().getData());

        ae.end(context, context.getAction());
        assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());
    }
View Full Code Here

            public boolean evaluate() throws Exception {
                return runningJob.isComplete();
            }
        });
        assertTrue(runningJob.isSuccessful());
        ActionExecutor ae = new JavaActionExecutor();
        ae.check(context, context.getAction());
        assertEquals("SUCCEEDED", context.getAction().getExternalStatus());
        assertNull(context.getAction().getData());

        ae.end(context, context.getAction());
        assertEquals(WorkflowAction.Status.OK, context.getAction().getStatus());

        assertTrue(fs.exists(mkdir));
        assertFalse(fs.exists(delete));
    }
View Full Code Here

     *
     * @see org.apache.oozie.command.XCommand#execute()
     */
    @Override
    protected Void execute() throws CommandException {
        ActionExecutor executor = Services.get().get(ActionService.class).getExecutor(this.wfactionBean.getType());
        // this is done because oozie notifications (of sub-wfs) is send
        // every status change, not only on completion.
        if (executor.isCompleted(externalStatus)) {
            queue(new ActionCheckXCommand(this.wfactionBean.getId(), getPriority(), -1));
        }
        return null;
    }
View Full Code Here

                            "The wf action :" + id + " has been udated recently. Ignoring ActionCheckCommand!");
                    return null;
                }
            }
            if (workflow.getStatus() == WorkflowJob.Status.RUNNING) {
                ActionExecutor executor = Services.get().get(ActionService.class).getExecutor(action.getType());
                if (executor != null) {
                    ActionExecutorContext context = null;
                    try {
                        boolean isRetry = false;
                        context = new ActionCommand.ActionExecutorContext(workflow, action, isRetry);
                        incrActionCounter(action.getType(), 1);

                        Instrumentation.Cron cron = new Instrumentation.Cron();
                        cron.start();
                        executor.check(context, action);
                        cron.stop();
                        addActionCron(action.getType(), cron);

                        if (action.isExecutionComplete()) {
                            if (!context.isExecuted()) {
                                XLog.getLog(getClass()).warn(XLog.OPS,
                                                             "Action Completed, ActionExecutor [{0}] must call setExecutionData()",
                                                             executor.getType());
                                action.setErrorInfo(EXEC_DATA_MISSING,
                                                    "Execution Complete, but Execution Data Missing from Action");
                                failJob(context);
                                action.setLastCheckTime(new Date());
                                store.updateAction(action);
View Full Code Here

        WorkflowJobBean workflow = store.getWorkflow(jobId, false);
        setLogInfo(workflow);
        WorkflowActionBean action = store.getAction(id, false);
        setLogInfo(action);
        if (action.isPending() && (action.getStatus() == WorkflowActionBean.Status.KILLED)) {
            ActionExecutor executor = Services.get().get(ActionService.class).getExecutor(action.getType());
            if (executor != null) {
                try {
                    boolean isRetry = false;
                    ActionExecutorContext context = new ActionCommand.ActionExecutorContext(workflow, action, isRetry);
                    incrActionCounter(action.getType(), 1);

                    Instrumentation.Cron cron = new Instrumentation.Cron();
                    cron.start();
                    executor.kill(context, action);
                    cron.stop();
                    addActionCron(action.getType(), cron);

                    action.resetPending();
                    action.setStatus(WorkflowActionBean.Status.KILLED);
View Full Code Here

        if (action.isPending()
                && (action.getStatus() == WorkflowActionBean.Status.PREP
                || action.getStatus() == WorkflowActionBean.Status.START_RETRY || action.getStatus() == WorkflowActionBean.Status.START_MANUAL)) {
            if (workflow.getStatus() == WorkflowJob.Status.RUNNING) {

                ActionExecutor executor = Services.get().get(ActionService.class).getExecutor(action.getType());
                Configuration conf = workflow.getWorkflowInstance().getConf();

                int maxRetries = conf.getInt(OozieClient.ACTION_MAX_RETRIES, executor.getMaxRetries());
                long retryInterval = conf.getLong(OozieClient.ACTION_RETRY_INTERVAL, executor.getRetryInterval());
                executor.setMaxRetries(maxRetries);
                executor.setRetryInterval(retryInterval);

                if (executor != null) {
                    ActionExecutorContext context = null;
                    try {
                        boolean isRetry = false;
                        if (action.getStatus() == WorkflowActionBean.Status.START_RETRY
                                || action.getStatus() == WorkflowActionBean.Status.START_MANUAL) {
                            isRetry = true;
                        }
                        context = new ActionCommand.ActionExecutorContext(workflow, action, isRetry);
                        try {
                            String tmpActionConf = XmlUtils.removeComments(action.getConf());
                            String actionConf = context.getELEvaluator().evaluate(tmpActionConf, String.class);
                            action.setConf(actionConf);

                            XLog.getLog(getClass()).debug("Start, name [{0}] type [{1}] configuration{E}{E}{2}{E}",
                                                          action.getName(), action.getType(), actionConf);

                        }
                        catch (ELEvaluationException ex) {
                            throw new ActionExecutorException(ActionExecutorException.ErrorType.TRANSIENT,
                                                              EL_EVAL_ERROR, ex.getMessage(), ex);
                        }
                        catch (ELException ex) {
                            context.setErrorInfo(EL_ERROR, ex.getMessage());
                            XLog.getLog(getClass()).warn("ELException in ActionStartCommand ", ex.getMessage(), ex);
                            handleError(context, store, workflow, action);
                            return null;
                        }
                        catch (org.jdom.JDOMException je) {
                            context.setErrorInfo("ParsingError", je.getMessage());
                            XLog.getLog(getClass()).warn("JDOMException in ActionStartCommand ", je.getMessage(), je);
                            handleError(context, store, workflow, action);
                            return null;
                        }
                        catch (Exception ex) {
                            context.setErrorInfo(EL_ERROR, ex.getMessage());
                            XLog.getLog(getClass()).warn("Exception in ActionStartCommand ", ex.getMessage(), ex);
                            handleError(context, store, workflow, action);
                            return null;
                        }
                        action.setErrorInfo(null, null);
                        incrActionCounter(action.getType(), 1);

                        Instrumentation.Cron cron = new Instrumentation.Cron();
                        cron.start();
                        executor.start(context, action);
                        cron.stop();
                        FaultInjection.activate("org.apache.oozie.command.SkipCommitFaultInjection");
                        addActionCron(action.getType(), cron);

                        action.setRetries(0);
                        if (action.isExecutionComplete()) {
                            if (!context.isExecuted()) {
                                XLog.getLog(getClass()).warn(XLog.OPS,
                                                             "Action Completed, ActionExecutor [{0}] must call setExecutionData()",
                                                             executor.getType());
                                action.setErrorInfo(EXEC_DATA_MISSING,
                                                    "Execution Complete, but Execution Data Missing from Action");
                                failJob(context);
                                store.updateAction(action);
                                store.updateWorkflow(workflow);
                                return null;
                            }
                            action.setPending();
                            queueCallable(new ActionEndCommand(action.getId(), action.getType()));
                        }
                        else {
                            if (!context.isStarted()) {
                                XLog.getLog(getClass()).warn(XLog.OPS,
                                                             "Action Started, ActionExecutor [{0}] must call setStartData()",
                                                             executor.getType());
                                action.setErrorInfo(START_DATA_MISSING,
                                                    "Execution Started, but Start Data Missing from Action");
                                failJob(context);
                                store.updateAction(action);
                                store.updateWorkflow(workflow);
View Full Code Here

    @Override
    protected Void call(WorkflowStore store) throws StoreException, CommandException {
        WorkflowActionBean action = store.getAction(actionId, false);
        setLogInfo(action);
        if (action.getStatus() == WorkflowActionBean.Status.RUNNING) {
            ActionExecutor executor = Services.get().get(ActionService.class).getExecutor(action.getType());
            // this is done because oozie notifications (of sub-wfs) is send
            // every status change, not only on completion.
            if (executor.isCompleted(externalStatus)) {
                queueCallable(new ActionCheckCommand(action.getId(), getPriority(), -1));
            }
        }
        else {
            throw new CommandException(ErrorCode.E0800, actionId, action.getStatus());
View Full Code Here

TOP

Related Classes of org.apache.oozie.action.ActionExecutor$Context

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.