use of org.apache.oozie.client.CoordinatorJob in project oozie by apache.
the class TestCoordMaterializeTransitionXCommand method checkCoordActions.
private void checkCoordActions(String jobId, int number, CoordinatorJob.Status status) {
try {
JPAService jpaService = Services.get().get(JPAService.class);
Integer actionsSize = jpaService.execute(new CoordJobGetActionsJPAExecutor(jobId));
if (actionsSize != number) {
fail("Should have " + number + " actions created for job " + jobId + ", but has " + actionsSize + " actions.");
}
if (status != null) {
CoordinatorJob job = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
if (job.getStatus() != status) {
fail("Job status " + job.getStatus() + " should be " + status);
}
}
} catch (JPAExecutorException se) {
se.printStackTrace();
fail("Job ID " + jobId + " was not stored properly in db");
}
}
use of org.apache.oozie.client.CoordinatorJob in project oozie by apache.
the class TestCoordInputLogicPush method startCoordAction.
private void startCoordAction(final String jobId) throws CommandException, JPAExecutorException {
new CoordMaterializeTransitionXCommand(jobId, 3600).call();
new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
new CoordPushDependencyCheckXCommand(jobId + "@1").call();
new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
waitFor(50 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
return !actionBean.getStatus().equals(CoordinatorAction.Status.WAITING);
}
});
CoordinatorAction actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
assertFalse("Action status should not be waiting", actionBean.getStatus().equals(CoordinatorAction.Status.WAITING));
waitFor(50 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
return !actionBean.getStatus().equals(CoordinatorAction.Status.READY);
}
});
CoordinatorJob coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, jobId);
new CoordActionStartXCommand(actionBean.getId(), coordJob.getUser(), coordJob.getAppName(), actionBean.getJobId()).call();
}
use of org.apache.oozie.client.CoordinatorJob in project oozie by apache.
the class TestCoordinatorInputLogic method startCoordAction.
private void startCoordAction(final String jobId, final CoordinatorAction.Status coordActionStatus) throws CommandException, JPAExecutorException {
new CoordMaterializeTransitionXCommand(jobId, 3600).call();
new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
waitFor(50 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
return !actionBean.getStatus().equals(CoordinatorAction.Status.WAITING);
}
});
CoordinatorAction actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
assertFalse(actionBean.getStatus().equals(coordActionStatus));
CoordinatorJob coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, jobId);
new CoordActionStartXCommand(actionBean.getId(), coordJob.getUser(), coordJob.getAppName(), actionBean.getJobId()).call();
}
use of org.apache.oozie.client.CoordinatorJob in project oozie by apache.
the class TestRecoveryService method testBundleRecoveryCoordExists.
/**
* If the bundle action is in PREP state and coord is already created, recovery should not submit new coord
* @throws Exception
*/
public void testBundleRecoveryCoordExists() throws Exception {
final BundleJobBean bundle;
final CoordinatorJob coord;
bundle = addRecordToBundleJobTable(Job.Status.RUNNING, false);
coord = addRecordToCoordJobTable(Job.Status.PREP, false, false);
addRecordToBundleActionTable(bundle.getId(), coord.getId(), "coord1", 1, Job.Status.PREP);
final JPAService jpaService = Services.get().get(JPAService.class);
sleep(3000);
Runnable recoveryRunnable = new RecoveryRunnable(0, 1, 1);
recoveryRunnable.run();
waitFor(3000, new Predicate() {
public boolean evaluate() throws Exception {
BundleActionBean mybundleAction = jpaService.execute(new BundleActionGetJPAExecutor(bundle.getId(), "coord1"));
return !mybundleAction.getCoordId().equals(coord.getId());
}
});
BundleActionBean mybundleAction = jpaService.execute(new BundleActionGetJPAExecutor(bundle.getId(), "coord1"));
assertEquals(coord.getId(), mybundleAction.getCoordId());
}
use of org.apache.oozie.client.CoordinatorJob in project oozie by apache.
the class MockCoordinatorEngineService method reset.
public static void reset() {
did = null;
offset = null;
length = null;
order = null;
filter = null;
coordJobs = new ArrayList<CoordinatorJob>();
coordWfActions = new ArrayList<CoordinatorWfActionBean>();
startedCoordJobs = new ArrayList<Boolean>();
for (int i = 0; i < INIT_COORD_COUNT; i++) {
coordJobs.add(createDummyCoordinatorJob(i));
startedCoordJobs.add(false);
}
for (int i = 0; i < INIT_WF_ACTION_COUNT; i++) {
coordWfActions.add(createDummyCoordWfAction("actionTest", i + 1));
}
String nullReason = CoordinatorWfAction.NullReason.ACTION_NULL.getNullReason("actionTest2", "wf1");
coordWfActions.add(new CoordinatorWfActionBean(INIT_WF_ACTION_COUNT + 1, null, nullReason));
}
Aggregations