use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleRerunXCommand method testBundleRerunWithError.
/**
* Test : Rerun a DONEWITHERROR bundle job. Status should
* change to RUNNINGWITHERROR
*
* @throws Exception
*/
public void testBundleRerunWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
services = new Services();
services.init();
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.DONEWITHERROR, false);
CoordinatorJobBean coord1 = addRecordToCoordJobTable("action1", CoordinatorJob.Status.SUCCEEDED, false, false);
CoordinatorJobBean coord2 = addRecordToCoordJobTable("action2", CoordinatorJob.Status.FAILED, false, false);
this.addRecordToBundleActionTable(job.getId(), coord1.getId(), "action1", 0, Job.Status.SUCCEEDED);
this.addRecordToBundleActionTable(job.getId(), coord2.getId(), "action2", 0, Job.Status.FAILED);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.DONEWITHERROR, job.getStatus());
new BundleRerunXCommand(job.getId(), null, "2009-02-01T00:00Z", false, true).call();
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.RUNNINGWITHERROR, job.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleRerunXCommand method testBundleRerunInSuspended.
/**
* Test : Rerun suspended bundle job
*
* @throws Exception
*/
public void testBundleRerunInSuspended() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUSPENDED, false);
CoordinatorJobBean coord1 = addRecordToCoordJobTable("action1", CoordinatorJob.Status.SUSPENDED, false, false);
CoordinatorJobBean coord2 = addRecordToCoordJobTable("action2", CoordinatorJob.Status.SUSPENDED, false, false);
this.addRecordToBundleActionTable(job.getId(), coord1.getId(), "action1", 0, Job.Status.SUSPENDED);
this.addRecordToBundleActionTable(job.getId(), coord2.getId(), "action2", 0, Job.Status.SUSPENDED);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.SUSPENDED, job.getStatus());
new BundleRerunXCommand(job.getId(), "action2", null, false, true).call();
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.RUNNING, job.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleRerunXCommand method testBundleRerunInPaused.
/**
* Test : Rerun paused bundle job
*
* @throws Exception
*/
public void testBundleRerunInPaused() throws Exception {
Date curr = new Date();
Date pauseTime = new Date(curr.getTime() - 1000);
BundleJobBean job = this.addRecordToBundleJobTableWithPausedTime(Job.Status.PAUSED, false, pauseTime);
this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.SUCCEEDED);
this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.PAUSED);
addRecordToCoordJobTable("action1", CoordinatorJob.Status.SUCCEEDED, false, false);
addRecordToCoordJobTable("action2", CoordinatorJob.Status.PAUSED, false, false);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.PAUSED, job.getStatus());
new BundleRerunXCommand(job.getId(), "action2", null, false, true).call();
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.PAUSED, job.getStatus());
assertNotNull(job.getPauseTime());
assertFalse(job.isPending());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleRerunXCommand method testBundleRerun1.
/**
* Test : Rerun bundle job for dateScope
*
* @throws Exception
*/
public void testBundleRerun1() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);
CoordinatorJobBean coord1 = addRecordToCoordJobTable("action1", CoordinatorJob.Status.SUCCEEDED, false, false);
CoordinatorJobBean coord2 = addRecordToCoordJobTable("action2", CoordinatorJob.Status.SUCCEEDED, false, false);
this.addRecordToBundleActionTable(job.getId(), coord1.getId(), "action1", 0, Job.Status.SUCCEEDED);
this.addRecordToBundleActionTable(job.getId(), coord2.getId(), "action2", 0, Job.Status.SUCCEEDED);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.SUCCEEDED, job.getStatus());
new BundleRerunXCommand(job.getId(), null, "2009-02-01T00:00Z", false, true).call();
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.RUNNING, job.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleStartXCommand method testBundleStartWithFailedCoordinator.
public void testBundleStartWithFailedCoordinator() throws Exception {
services.destroy();
services = new Services();
String[] excludeServices = { "org.apache.oozie.service.UUIDService", "org.apache.oozie.service.StatusTransitService" };
Configuration conf = services.getConf();
setClassesToBeExcluded(conf, excludeServices);
conf.set(Services.CONF_SERVICE_CLASSES, conf.get(Services.CONF_SERVICE_CLASSES) + "," + DummyUUIDService.class.getName());
services.init();
CoordinatorJobBean coordJob = new CoordinatorJobBean();
coordJob.setId("dummy-coord-id");
JPAService jpaService = Services.get().get(JPAService.class);
CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
jpaService.execute(coordInsertCmd);
BundleJobBean job = addRecordToBundleJobTable(Job.Status.PREP, false);
BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(job.getStatus(), Job.Status.PREP);
new BundleStartXCommand(job.getId()).call();
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(job.getStatus(), Job.Status.RUNNING);
sleep(2000);
List<BundleActionBean> actions = BundleActionQueryExecutor.getInstance().getList(BundleActionQuery.GET_BUNDLE_ACTIONS_STATUS_UNIGNORED_FOR_BUNDLE, job.getId());
assertNull(actions.get(0).getCoordId());
assertEquals(Job.Status.FAILED, actions.get(0).getStatus());
Runnable runnable = new StatusTransitRunnable();
// 1st run of StatusTransitionService changes bundle to running
runnable.run();
sleep(2000);
// 2nd run changes bundle to DoneWithError
runnable.run();
sleep(2000);
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(job.getStatus(), Job.Status.DONEWITHERROR);
}
Aggregations