Repository: oozie Updated Branches: refs/heads/master 74cb3b0bc -> 3637874e9
OOZIE-1812 Bundle status is always in RUNNING if one of the action status is in PREP (puru via rohini) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/3637874e Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/3637874e Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/3637874e Branch: refs/heads/master Commit: 3637874e911b5b15103015285b6ac7b7703ea8cc Parents: 74cb3b0 Author: Rohini Palaniswamy <[email protected]> Authored: Sat May 31 20:00:27 2014 -0700 Committer: Rohini Palaniswamy <[email protected]> Committed: Sat May 31 20:00:27 2014 -0700 ---------------------------------------------------------------------- .../oozie/service/StatusTransitService.java | 24 +++++++++------- .../oozie/service/TestStatusTransitService.java | 29 ++++++++++++++++++++ release-log.txt | 1 + 3 files changed, 44 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/3637874e/core/src/main/java/org/apache/oozie/service/StatusTransitService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/StatusTransitService.java b/core/src/main/java/org/apache/oozie/service/StatusTransitService.java index e140e64..21ac25f 100644 --- a/core/src/main/java/org/apache/oozie/service/StatusTransitService.java +++ b/core/src/main/java/org/apache/oozie/service/StatusTransitService.java @@ -426,7 +426,7 @@ public class StatusTransitService implements Service { if (bundleActionStatus.containsKey(Job.Status.PREP)) { // If all the bundle actions are PREP then bundle job should be RUNNING. if (bundleActions.size() > bundleActionStatus.get(Job.Status.PREP)) { - bundleStatus[0] = Job.Status.RUNNING; + bundleStatus[0] = getRunningStatus(bundleActionStatus); ret = true; } } @@ -618,21 +618,25 @@ public class StatusTransitService implements Service { List<BundleActionBean> bundleActions, Job.Status[] bundleStatus) { boolean ret = false; if (bundleStatus[0] != Job.Status.PREP) { - if (bundleActionStatus.containsKey(Job.Status.FAILED) - || bundleActionStatus.containsKey(Job.Status.KILLED) - || bundleActionStatus.containsKey(Job.Status.DONEWITHERROR) - || bundleActionStatus.containsKey(Job.Status.RUNNINGWITHERROR)) { - bundleStatus[0] = Job.Status.RUNNINGWITHERROR; - } - else { - bundleStatus[0] = Job.Status.RUNNING; - } + bundleStatus[0] = getRunningStatus(bundleActionStatus); ret = true; } return ret; } + private Job.Status getRunningStatus(HashMap<Job.Status, Integer> bundleActionStatus) { + if (bundleActionStatus.containsKey(Job.Status.FAILED) + || bundleActionStatus.containsKey(Job.Status.KILLED) + || bundleActionStatus.containsKey(Job.Status.DONEWITHERROR) + || bundleActionStatus.containsKey(Job.Status.RUNNINGWITHERROR)) { + return Job.Status.RUNNINGWITHERROR; + } + else { + return Job.Status.RUNNING; + } + } + private void updateBundleJob(boolean isPending, BundleJobBean bundleJob, Job.Status bundleStatus) throws JPAExecutorException { String jobId = bundleJob.getId(); http://git-wip-us.apache.org/repos/asf/oozie/blob/3637874e/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java b/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java index b767b69..bb99138 100644 --- a/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java +++ b/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java @@ -1475,4 +1475,33 @@ public class TestStatusTransitService extends XDataTestCase { bundleJob = jpaService.execute(new BundleJobGetJPAExecutor(bundleId)); assertEquals(CoordinatorJob.Status.RUNNING, bundleJob.getStatus()); } + + // Test bundle transition from running to runningwitherror when one action is killed. + public void testBundleStatusTransitRunningWithError() throws Exception { + Services.get().destroy(); + setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false"); + new Services().init(); + + BundleJobBean bundleJob = this.addRecordToBundleJobTable(Job.Status.RUNNING, true); + final String bundleId = bundleJob.getId(); + addRecordToBundleActionTable(bundleId, "action1-C", 0, Job.Status.PREP); + addRecordToBundleActionTable(bundleId, "action2-C", 0, Job.Status.RUNNING); + BundleActionBean action3 = addRecordToBundleActionTable(bundleId, "action3-C", 0, Job.Status.DONEWITHERROR); + + Runnable runnable = new StatusTransitRunnable(); + runnable.run(); + bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_STATUS, bundleId); + assertEquals(Job.Status.RUNNINGWITHERROR, bundleJob.getStatus()); + + action3.setStatus(Job.Status.SUSPENDED); + action3.setPending(1); + action3.setLastModifiedTime(new Date()); + BundleActionQueryExecutor.getInstance().executeUpdate( + BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID, action3); + runnable = new StatusTransitRunnable(); + runnable.run(); + bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_STATUS, bundleId); + assertEquals(Job.Status.RUNNING, bundleJob.getStatus()); + + } } http://git-wip-us.apache.org/repos/asf/oozie/blob/3637874e/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 4e909e3..fbd7bea 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 4.1.0 release (trunk - unreleased) +OOZIE-1812 Bundle status is always in RUNNING if one of the action status is in PREP (puru via rohini) OOZIE-1848 Pig actions fail due to missing joda-time jar from pig sharelib (bzhang) OOZIE-1319 "LAST_ONLY" in execution control for coordinator job still runs all the actions (rkanter) OOZIE-1862 Add hadoop token file location for Hive/Tez jobs (venkatnrangan via bzhang)
