Examples of WorkflowActionGetJPAExecutor


Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

    @SuppressWarnings("deprecation")
    public void testActionCheck() throws Exception {
        JPAService jpaService = Services.get().get(JPAService.class);
        WorkflowJobBean job = this.addRecordToWfJobTable(WorkflowJob.Status.RUNNING, WorkflowInstance.Status.RUNNING);
        WorkflowActionBean action = this.addRecordToWfActionTable(job.getId(), "1", WorkflowAction.Status.PREP);
        WorkflowActionGetJPAExecutor wfActionGetCmd = new WorkflowActionGetJPAExecutor(action.getId());

        new ActionStartXCommand(action.getId(), "map-reduce").call();
        action = jpaService.execute(wfActionGetCmd);

        ActionExecutorContext context = new ActionXCommand.ActionExecutorContext(job, action, false, false);
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

            jpaService = Services.get().get(JPAService.class);
            if (jpaService != null) {
                this.wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(jobId));
                LogUtils.setLogInfo(wfJob, logInfo);
                if (actionId != null) {
                    this.wfAction = jpaService.execute(new WorkflowActionGetJPAExecutor(actionId));
                    LogUtils.setLogInfo(wfAction, logInfo);
                }
            }
            else {
                throw new CommandException(ErrorCode.E0610);
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

        if (completed) {
            try {
                for (String actionToKillId : WorkflowStoreService.getActionsToKill(workflowInstance)) {
                    WorkflowActionBean actionToKill;

                    actionToKill = jpaService.execute(new WorkflowActionGetJPAExecutor(actionToKillId));

                    actionToKill.setPending();
                    actionToKill.setStatus(WorkflowActionBean.Status.KILLED);
                    jpaService.execute(new WorkflowActionUpdateJPAExecutor(actionToKill));
                    queue(new ActionKillXCommand(actionToKill.getId(), actionToKill.getType()));
                }

                for (String actionToFailId : WorkflowStoreService.getActionsToFail(workflowInstance)) {
                    WorkflowActionBean actionToFail = jpaService.execute(new WorkflowActionGetJPAExecutor(
                            actionToFailId));
                    actionToFail.resetPending();
                    actionToFail.setStatus(WorkflowActionBean.Status.FAILED);
                    queue(new NotificationXCommand(wfJob, actionToFail));
                    SLADbXOperations.writeStausEvent(wfAction.getSlaXml(), wfAction.getId(), Status.FAILED,
                            SlaAppType.WORKFLOW_ACTION);
                    jpaService.execute(new WorkflowActionUpdateJPAExecutor(actionToFail));
                }
            }
            catch (JPAExecutorException je) {
                throw new CommandException(je);
            }

            wfJob.setStatus(WorkflowJob.Status.valueOf(workflowInstance.getStatus().toString()));
            wfJob.setEndTime(new Date());
            wfJob.setWorkflowInstance(workflowInstance);
            Status slaStatus = Status.SUCCEEDED;
            switch (wfJob.getStatus()) {
                case SUCCEEDED:
                    slaStatus = Status.SUCCEEDED;
                    break;
                case KILLED:
                    slaStatus = Status.KILLED;
                    break;
                case FAILED:
                    slaStatus = Status.FAILED;
                    break;
                default: // TODO SUSPENDED
                    break;
            }
            SLADbXOperations.writeStausEvent(wfJob.getSlaXml(), jobId, slaStatus, SlaAppType.WORKFLOW_JOB);
            queue(new NotificationXCommand(wfJob));
            if (wfJob.getStatus() == WorkflowJob.Status.SUCCEEDED) {
                InstrumentUtils.incrJobCounter(INSTR_SUCCEEDED_JOBS_COUNTER_NAME, 1, getInstrumentation());
            }

            // output message for Kill node
            if (wfAction != null) { // wfAction could be a no-op job
                NodeDef nodeDef = workflowInstance.getNodeDef(wfAction.getExecutionPath());
                if (nodeDef != null && nodeDef instanceof KillNodeDef) {
                    boolean isRetry = false;
                    boolean isUserRetry = false;
                    ActionExecutorContext context = new ActionXCommand.ActionExecutorContext(wfJob, wfAction, isRetry,
                            isUserRetry);
                    try {
                        String tmpNodeConf = nodeDef.getConf();
                        String actionConf = context.getELEvaluator().evaluate(tmpNodeConf, String.class);
                        LOG.debug("Try to resolve KillNode message for jobid [{0}], actionId [{1}], before resolve [{2}], after resolve [{3}]",
                                        jobId, actionId, tmpNodeConf, actionConf);
                        if (wfAction.getErrorCode() != null) {
                            wfAction.setErrorInfo(wfAction.getErrorCode(), actionConf);
                        }
                        else {
                            wfAction.setErrorInfo(ErrorCode.E0729.toString(), actionConf);
                        }
                        jpaService.execute(new WorkflowActionUpdateJPAExecutor(wfAction));
                    }
                    catch (JPAExecutorException je) {
                        throw new CommandException(je);
                    }
                    catch (Exception ex) {
                        LOG.warn("Exception in SignalXCommand ", ex.getMessage(), ex);
                        throw new CommandException(ErrorCode.E0729, wfAction.getName(), ex);
                    }
                }
            }

        }
        else {
            for (WorkflowActionBean newAction : WorkflowStoreService.getStartedActions(workflowInstance)) {
                String skipVar = workflowInstance.getVar(newAction.getName() + WorkflowInstance.NODE_VAR_SEPARATOR
                        + ReRunXCommand.TO_SKIP);
                boolean skipNewAction = false;
                if (skipVar != null) {
                    skipNewAction = skipVar.equals("true");
                }
                try {
                    if (skipNewAction) {
                        WorkflowActionBean oldAction;

                        oldAction = jpaService.execute(new WorkflowActionGetJPAExecutor(newAction.getId()));

                        oldAction.setPending();
                        jpaService.execute(new WorkflowActionUpdateJPAExecutor(oldAction));

                        queue(new SignalXCommand(jobId, oldAction.getId()));
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

        assertTrue(wfActions.size() > 0);

        final String wfActionId = wfActions.get(0).getId();
        waitFor(20 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                WorkflowActionBean wfAction = jpaService.execute(new WorkflowActionGetJPAExecutor(wfActionId));
                return wfAction.getExternalId() != null;
            }
        });

        WorkflowActionBean wfAction = jpaService.execute(new WorkflowActionGetJPAExecutor(wfActionId));
        assertNotNull(wfAction.getExternalId());
    }
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

    protected void loadState() throws CommandException {
        try {
            jpaService = Services.get().get(JPAService.class);
            if (jpaService != null) {
                this.wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(jobId));
                this.wfAction = jpaService.execute(new WorkflowActionGetJPAExecutor(actionId));
                LogUtils.setLogInfo(wfJob, logInfo);
                LogUtils.setLogInfo(wfAction, logInfo);
            }
            else {
                throw new CommandException(ErrorCode.E0610);
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

    protected void loadState() throws CommandException {
        try {
            jpaService = Services.get().get(JPAService.class);
            if (jpaService != null) {
                this.wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(jobId));
                this.wfAction = jpaService.execute(new WorkflowActionGetJPAExecutor(actionId));
                LogUtils.setLogInfo(wfJob, logInfo);
                LogUtils.setLogInfo(wfAction, logInfo);
            }
            else {
                throw new CommandException(ErrorCode.E0610);
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

    protected void eagerLoadState() throws CommandException {
        try {
            jpaService = Services.get().get(JPAService.class);
            if (jpaService != null) {
                this.wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(jobId));
                this.wfAction = jpaService.execute(new WorkflowActionGetJPAExecutor(actionId));
                LogUtils.setLogInfo(wfJob, logInfo);
                LogUtils.setLogInfo(wfAction, logInfo);
            }
            else {
                throw new CommandException(ErrorCode.E0610);
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

        try {
            jpaService = Services.get().get(JPAService.class);

            if (jpaService != null) {
                this.wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(jobId));
                this.wfAction = jpaService.execute(new WorkflowActionGetJPAExecutor(actionId));
                LogUtils.setLogInfo(wfJob, logInfo);
                LogUtils.setLogInfo(wfAction, logInfo);
            }
            else {
                throw new CommandException(ErrorCode.E0610);
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

       
        Runnable recoveryRunnable = new RecoveryRunnable(0, 60, 60);
        recoveryRunnable.run();
        Thread.sleep(3000);
       
        final WorkflowActionGetJPAExecutor wfActionGetCmd = new WorkflowActionGetJPAExecutor(action.getId());

        waitFor(5000, new Predicate() {
            public boolean evaluate() throws Exception {
              WorkflowActionBean a = jpaService.execute(wfActionGetCmd);
                return a.getExternalId() != null;
View Full Code Here

Examples of org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor

        WorkflowActionBean action = this.addRecordToWfActionTable(job.getId(), "1", WorkflowAction.Status.OK);

        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        WorkflowJobGetJPAExecutor wfJobGetCmd = new WorkflowJobGetJPAExecutor(job.getId());
        WorkflowActionGetJPAExecutor wfActionGetCmd = new WorkflowActionGetJPAExecutor(action.getId());

        job = jpaService.execute(wfJobGetCmd);
        action = jpaService.execute(wfActionGetCmd);
        assertEquals(job.getStatus(), WorkflowJob.Status.SUCCEEDED);
        assertEquals(action.getStatus(), WorkflowAction.Status.OK);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.