use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleRerunXCommand method testBundleRerunInPrep.
/**
* Test : Rerun PREP bundle job
*
* @throws Exception
*/
public void testBundleRerunInPrep() throws Exception {
Date curr = new Date();
Date pauseTime = new Date(curr.getTime() - 1000);
BundleJobBean job = this.addRecordToBundleJobTableWithPausedTime(Job.Status.PREP, false, pauseTime);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.PREP, job.getStatus());
new BundleRerunXCommand(job.getId(), "action2", null, false, true).call();
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.PREP, job.getStatus());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleRerunXCommand method testBundleRerun2.
/**
* Test : Rerun bundle job for coordScope
*
* @throws Exception
*/
public void testBundleRerun2() 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(), "action1", 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 testBundleRerunInSuspendedWithError.
/**
* Test : Rerun SUSPENDEDINERROR bundle job
*
* @throws Exception
*/
public void testBundleRerunInSuspendedWithError() 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.SUSPENDEDWITHERROR, false);
CoordinatorJobBean coord1 = addRecordToCoordJobTable("action1", CoordinatorJob.Status.SUSPENDED, false, false);
CoordinatorJobBean coord2 = addRecordToCoordJobTable("action2", CoordinatorJob.Status.SUSPENDEDWITHERROR, false, false);
this.addRecordToBundleActionTable(job.getId(), coord1.getId(), "action1", 0, Job.Status.SUSPENDED);
this.addRecordToBundleActionTable(job.getId(), coord2.getId(), "action2", 0, Job.Status.SUSPENDEDWITHERROR);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.SUSPENDEDWITHERROR, job.getStatus());
new BundleRerunXCommand(job.getId(), "action2", null, 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 testBundleRerunInPausedWithError.
/**
* Test : Rerun PAUSEDINERROR bundle job. Status shouldn't change.
*
* @throws Exception
*/
public void testBundleRerunInPausedWithError() throws Exception {
Date curr = new Date();
Date pauseTime = new Date(curr.getTime() - 1000);
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
services = new Services();
services.init();
BundleJobBean job = this.addRecordToBundleJobTableWithPausedTime(Job.Status.PAUSEDWITHERROR, false, pauseTime);
this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.FAILED);
this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.PAUSED);
addRecordToCoordJobTable("action1", CoordinatorJob.Status.FAILED, 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.PAUSEDWITHERROR, job.getStatus());
new BundleRerunXCommand(job.getId(), "action2", null, false, true).call();
job = jpaService.execute(bundleJobGetExecutor);
assertEquals(Job.Status.PAUSEDWITHERROR, job.getStatus());
assertNotNull(job.getPauseTime());
assertFalse(job.isPending());
}
use of org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor in project oozie by apache.
the class TestBundleStartXCommand method testBundleStart3.
/**
* Test : Start bundle job when certain coord jobs are not enabled
*
* @throws Exception
*/
public void testBundleStart3() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTableDisabledCoord(Job.Status.PREP);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
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());
assertEquals(1, actions.size());
assertEquals(job.getId(), actions.get(0).getBundleId());
}
Aggregations