Search in sources :

Example 51 with BundleJobGetJPAExecutor

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());
}
Also used : BundleJobGetJPAExecutor(org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor) BundleJobBean(org.apache.oozie.BundleJobBean) JPAService(org.apache.oozie.service.JPAService) Date(java.util.Date)

Example 52 with BundleJobGetJPAExecutor

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());
}
Also used : BundleJobGetJPAExecutor(org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor) CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) BundleJobBean(org.apache.oozie.BundleJobBean) JPAService(org.apache.oozie.service.JPAService)

Example 53 with BundleJobGetJPAExecutor

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());
}
Also used : BundleJobGetJPAExecutor(org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor) Services(org.apache.oozie.service.Services) CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) BundleJobBean(org.apache.oozie.BundleJobBean) JPAService(org.apache.oozie.service.JPAService)

Example 54 with BundleJobGetJPAExecutor

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());
}
Also used : BundleJobGetJPAExecutor(org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor) Services(org.apache.oozie.service.Services) BundleJobBean(org.apache.oozie.BundleJobBean) JPAService(org.apache.oozie.service.JPAService) Date(java.util.Date)

Example 55 with BundleJobGetJPAExecutor

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());
}
Also used : BundleJobGetJPAExecutor(org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor) BundleJobBean(org.apache.oozie.BundleJobBean) JPAService(org.apache.oozie.service.JPAService) BundleActionBean(org.apache.oozie.BundleActionBean)

Aggregations

BundleJobBean (org.apache.oozie.BundleJobBean)69 BundleJobGetJPAExecutor (org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor)69 JPAService (org.apache.oozie.service.JPAService)54 BundleActionBean (org.apache.oozie.BundleActionBean)33 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)32 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)30 BundleActionGetJPAExecutor (org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor)21 CoordJobGetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor)20 Date (java.util.Date)18 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)14 StatusTransitRunnable (org.apache.oozie.service.StatusTransitService.StatusTransitRunnable)14 WorkflowJobGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor)13 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)12 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)10 CoordActionGetJPAExecutor (org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor)9 WorkflowActionGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor)9 IOException (java.io.IOException)8 CommandException (org.apache.oozie.command.CommandException)8 Configuration (org.apache.hadoop.conf.Configuration)7 XConfiguration (org.apache.oozie.util.XConfiguration)7