Search in sources :

Example 96 with JPAService

use of org.apache.oozie.service.JPAService in project oozie by apache.

the class TestBundlePauseUnpauseXCommand method testBundlePauseUnpause3.

/**
 * Test : Pause a RUNNINGWITHERROR bundle
 *
 * @throws Exception
 */
public void testBundlePauseUnpause3() throws Exception {
    BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNINGWITHERROR, false);
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(job.getId());
    job = jpaService.execute(bundleJobGetCmd);
    assertEquals(job.getStatus(), Job.Status.RUNNINGWITHERROR);
    new BundlePauseXCommand(job).call();
    job = jpaService.execute(bundleJobGetCmd);
    assertEquals(job.getStatus(), Job.Status.PAUSEDWITHERROR);
    new BundleUnpauseXCommand(job).call();
    job = jpaService.execute(bundleJobGetCmd);
    assertEquals(job.getStatus(), Job.Status.RUNNINGWITHERROR);
}
Also used : BundleJobGetJPAExecutor(org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor) BundleJobBean(org.apache.oozie.BundleJobBean) JPAService(org.apache.oozie.service.JPAService)

Example 97 with JPAService

use of org.apache.oozie.service.JPAService 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());
}
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 98 with JPAService

use of org.apache.oozie.service.JPAService 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());
}
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 99 with JPAService

use of org.apache.oozie.service.JPAService 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());
}
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 100 with JPAService

use of org.apache.oozie.service.JPAService 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());
}
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)

Aggregations

JPAService (org.apache.oozie.service.JPAService)449 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)156 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)152 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)113 Date (java.util.Date)95 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)94 CoordJobGetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor)84 BundleJobBean (org.apache.oozie.BundleJobBean)78 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)78 ArrayList (java.util.ArrayList)76 CommandException (org.apache.oozie.command.CommandException)66 List (java.util.List)59 BundleJobGetJPAExecutor (org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor)54 CoordActionGetJPAExecutor (org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor)54 WorkflowJobGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor)49 WorkflowActionGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor)47 HashMap (java.util.HashMap)41 BundleActionBean (org.apache.oozie.BundleActionBean)35 Configuration (org.apache.hadoop.conf.Configuration)32 EntityManager (javax.persistence.EntityManager)31