Package org.apache.oozie

Examples of org.apache.oozie.BundleActionBean


        bundleJob = jpaService.execute(new BundleJobGetJPAExecutor(bundleId));
        assertTrue(bundleJob.isPending());
        assertEquals(Job.Status.RUNNINGWITHERROR, bundleJob.getStatus());

        BundleActionBean bundleAction1 = jpaService.execute(new BundleActionGetJPAExecutor(bundleId, "action1"));
        assertFalse(bundleAction1.isPending());
        assertEquals(Job.Status.KILLED, bundleAction1.getStatus());

        CoordinatorJobBean coordJob1 = jpaService.execute(new CoordJobGetJPAExecutor("action1"));
        assertFalse(coordJob1.isPending());
        assertEquals(Job.Status.KILLED, coordJob1.getStatus());

        BundleActionBean bundleAction2 = jpaService.execute(new BundleActionGetJPAExecutor(bundleId, "action2"));
        assertTrue(bundleAction2.isPending());
        assertEquals(Job.Status.RUNNING, bundleAction2.getStatus());

        CoordinatorJobBean coordJob2 = jpaService.execute(new CoordJobGetJPAExecutor("action2"));
        assertTrue(coordJob2.isPending());
        assertEquals(Job.Status.RUNNING, coordJob2.getStatus());
    }
View Full Code Here


        new BundleRerunXCommand(bundleId, "action1", null, false, true).call();

        sleep(1000);

        BundleActionGetJPAExecutor bundleActionJPA = new BundleActionGetJPAExecutor(bundleId, "action1");
        BundleActionBean ba = jpaService.execute(bundleActionJPA);
        assertEquals(0, ba.getPending());
    }
View Full Code Here

        try {
            Query q = em.createNamedQuery("GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE");
            q.setParameter("bundleId", bundleId);
            List<Object[]> bundleActionList = q.getResultList();
            for (Object[] a : bundleActionList) {
                BundleActionBean bab = createBeanFromBundle(a);
                baBeans.add(bab);
            }
        }
        catch (Exception e) {
            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
View Full Code Here

        return baBeans;
    }

    private BundleActionBean createBeanFromBundle(Object[] arr) {
        BundleActionBean bab = new BundleActionBean();
        if (arr[0] != null) {
            bab.setCoordId((String) arr[0]);
        }
        if (arr[1] != null) {
            bab.setStatus(Job.Status.valueOf((String) arr[1]));
        }
        if (arr[2] != null) {
            bab.setPending((Integer) arr[2]);
        }

        return bab;
    }
View Full Code Here

        Date pauseTime = new Date(new Date().getTime() - 30 * 1000);
        job.setPauseTime(pauseTime);
        jpaService.execute(new BundleJobUpdateJPAExecutor(job));

        BundleActionBean bundleAction1 = this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.RUNNING);
        BundleActionBean bundleAction2 = this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.RUNNING);

        String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
        Date start = DateUtils.parseDateOozieTZ(currentDatePlusMonth);
        Date end = DateUtils.parseDateOozieTZ(currentDatePlusMonth);

        CoordinatorJobBean coordJob1 = addRecordToCoordJobTable("action1", CoordinatorJob.Status.RUNNING, start, end, false);
        CoordinatorJobBean coordJob2 = addRecordToCoordJobTable("action2", CoordinatorJob.Status.RUNNING, start, end, false);

        coordJob1.setPauseTime(pauseTime);
        coordJob1.setBundleId(job.getId());
        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob1));
        coordJob2.setPauseTime(pauseTime);
        coordJob2.setBundleId(job.getId());
        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob2));

        BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(Job.Status.RUNNING, job.getStatus());

        Runnable pauseStartRunnable = new PauseTransitRunnable();
        pauseStartRunnable.run();

        final String jobId = job.getId();
        waitFor(10 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                BundleJobBean bJob1 = jpaService.execute(new BundleJobGetJPAExecutor(jobId));
                return bJob1.getStatus() == Job.Status.PAUSED;
            }
        });

        final String coordJobId1 = coordJob1.getId();
        final String coordJobId2 = coordJob2.getId();
        waitFor(10 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorJobBean cJob1 = jpaService.execute(new CoordJobGetJPAExecutor(coordJobId1));
                return cJob1.getStatus() == Job.Status.PAUSED;
            }
        });

        job = jpaService.execute(new BundleJobGetJPAExecutor(jobId));
        assertEquals(Job.Status.PAUSED, job.getStatus());

        coordJob1 = jpaService.execute(new CoordJobGetJPAExecutor(coordJobId1));
        assertEquals(Job.Status.PAUSED, coordJob1.getStatus());

        coordJob2 = jpaService.execute(new CoordJobGetJPAExecutor(coordJobId2));
        assertEquals(Job.Status.PAUSED, coordJob2.getStatus());

        bundleAction1 = jpaService.execute(new BundleActionGetJPAExecutor(job.getId(), "action1"));
        assertEquals(Job.Status.PAUSED, bundleAction1.getStatus());

        bundleAction2 = jpaService.execute(new BundleActionGetJPAExecutor(job.getId(), "action2"));
        assertEquals(Job.Status.PAUSED, bundleAction2.getStatus());

    }
View Full Code Here

        assertNotNull(jpaService);

        job.setPauseTime(null);
        jpaService.execute(new BundleJobUpdateJPAExecutor(job));

        BundleActionBean bundleAction1 = this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.PAUSED);
        BundleActionBean bundleAction2 = this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.PAUSED);

        String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
        Date start = DateUtils.parseDateOozieTZ(currentDatePlusMonth);
        Date end = DateUtils.parseDateOozieTZ(currentDatePlusMonth);

        CoordinatorJobBean coordJob1 = addRecordToCoordJobTable("action1", CoordinatorJob.Status.PAUSED, start, end, false);
        CoordinatorJobBean coordJob2 = addRecordToCoordJobTable("action2", CoordinatorJob.Status.PAUSED, start, end, false);

        coordJob1.setPauseTime(null);
        coordJob1.setBundleId(job.getId());
        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob1));
        coordJob2.setPauseTime(null);
        coordJob2.setBundleId(job.getId());
        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob2));

        BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
        job = jpaService.execute(bundleJobGetExecutor);
        assertEquals(Job.Status.PAUSED, job.getStatus());

        Runnable pauseStartRunnable = new PauseTransitRunnable();
        pauseStartRunnable.run();

        final String jobId = job.getId();
        waitFor(10 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                BundleJobBean bJob1 = jpaService.execute(new BundleJobGetJPAExecutor(jobId));
                return bJob1.getStatus() == Job.Status.RUNNING;
            }
        });

        final String coordJobId1 = coordJob1.getId();
        final String coordJobId2 = coordJob2.getId();
        waitFor(10 * 1000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorJobBean cJob1 = jpaService.execute(new CoordJobGetJPAExecutor(coordJobId1));
                return cJob1.getStatus() == Job.Status.RUNNING;
            }
        });

        job = jpaService.execute(new BundleJobGetJPAExecutor(jobId));
        assertEquals(Job.Status.RUNNING, job.getStatus());

        coordJob1 = jpaService.execute(new CoordJobGetJPAExecutor(coordJobId1));
        assertEquals(Job.Status.RUNNING, coordJob1.getStatus());

        coordJob2 = jpaService.execute(new CoordJobGetJPAExecutor(coordJobId2));
        assertEquals(Job.Status.RUNNING, coordJob2.getStatus());

        bundleAction1 = jpaService.execute(new BundleActionGetJPAExecutor(job.getId(), "action1"));
        assertEquals(Job.Status.RUNNING, bundleAction1.getStatus());

        bundleAction2 = jpaService.execute(new BundleActionGetJPAExecutor(job.getId(), "action2"));
        assertEquals(Job.Status.RUNNING, bundleAction2.getStatus());

    }
View Full Code Here

        }
        catch (Exception e) {
            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
        }

        BundleActionBean bean = null;
        if (baBeans != null && baBeans.size() > 0) {
            bean = baBeans.get(0);
            return bean;
        }
        else {
View Full Code Here

                LOG.debug("No coord jobs for the bundle=[{0}], failed it!!", jobId);
                throw new CommandException(ErrorCode.E1318, jobId);
            }

            for (Entry<String, Boolean> coordName : map.entrySet()) {
                BundleActionBean action = createBundleAction(jobId, coordName.getKey(), coordName.getValue());
                insertList.add(action);
            }
        }
        else {
            throw new CommandException(ErrorCode.E0604, jobId);
View Full Code Here

            throw new CommandException(ErrorCode.E0604, jobId);
        }
    }

    private BundleActionBean createBundleAction(String jobId, String coordName, boolean isCritical) {
        BundleActionBean action = new BundleActionBean();
        action.setBundleActionId(jobId + "_" + coordName);
        action.setBundleId(jobId);
        action.setCoordName(coordName);
        action.setStatus(Job.Status.PREP);
        action.setLastModifiedTime(new Date());
        if (isCritical) {
            action.setCritical();
        }
        else {
            action.resetCritical();
        }
        return action;
    }
View Full Code Here

        }
    }

    private void updateBundleAction() throws JPAExecutorException {
        for(JsonBean bAction : insertList) {
            BundleActionBean action = (BundleActionBean) bAction;
            action.incrementAndGetPending();
            action.setLastModifiedTime(new Date());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.BundleActionBean

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.