You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2012/08/03 09:38:01 UTC
svn commit: r1368811 [1/3] - in /incubator/oozie/trunk: ./
core/src/main/java/org/apache/oozie/
core/src/main/java/org/apache/oozie/command/
core/src/main/java/org/apache/oozie/command/bundle/
core/src/main/java/org/apache/oozie/command/coord/ core/src...
Author: virag
Date: Fri Aug 3 07:38:00 2012
New Revision: 1368811
URL: http://svn.apache.org/viewvc?rev=1368811&view=rev
Log:
OOZIE-708 Update the parent entity status dynamically (virag)
Added:
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionsGetStatusPendingJPAExecutor.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningOrPendingJPAExecutor.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusJPAExecutor.java
Modified:
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/RerunTransitionXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/ResumeTransitionXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/SuspendTransitionXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetPendingJPAExecutor.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningJPAExecutor.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/StatusUtils.java
incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleJobSuspendXCommand.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordResumeXCommand.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordSubmitXCommand.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordSuspendXCommand.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsStatusByPendingFalseJPAExecutor.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java
incubator/oozie/trunk/docs/src/site/twiki/BundleFunctionalSpec.twiki
incubator/oozie/trunk/docs/src/site/twiki/CoordinatorFunctionalSpec.twiki
incubator/oozie/trunk/release-log.txt
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java Fri Aug 3 07:38:00 2012
@@ -47,6 +47,8 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "GET_BUNDLE_ACTIONS_FOR_BUNDLE", query = "select OBJECT(w) from BundleActionBean w where w.bundleId = :bundleId"),
+ @NamedQuery(name = "GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE", query = "select w.coordId, w.status, w.pending from BundleActionBean w where w.bundleId = :bundleId"),
+
@NamedQuery(name = "GET_BUNDLE_ACTIONS", query = "select OBJECT(w) from BundleActionBean w"),
@NamedQuery(name = "GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME", query = "select OBJECT(w) from BundleActionBean w where w.lastModifiedTimestamp >= :lastModifiedTime"),
@@ -63,7 +65,7 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "GET_BUNDLE_ACTIONS_NOT_EQUAL_STATUS_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.status <> :status"),
- @NamedQuery(name = "GET_BUNDLE_ACTIONS_NOT_TERMINATE_STATUS_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND (w.status = 'PERP' OR w.status = 'RUNNING' OR w.status = 'SUSPENDED' OR w.status = 'PREPSUSPENDED' OR w.status = 'PAUSED' OR w.status = 'PREPPAUSED')"),
+ @NamedQuery(name = "GET_BUNDLE_ACTIONS_NOT_TERMINATE_STATUS_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND (w.status = 'PREP' OR w.status = 'RUNNING' OR w.status = 'RUNNINGWITHERROR' OR w.status = 'SUSPENDED' OR w.status = 'SUSPENDEDWITHERROR' OR w.status = 'PREPSUSPENDED' OR w.status = 'PAUSED' OR w.status = 'PAUSEDWITHERROR' OR w.status = 'PREPPAUSED')"),
@NamedQuery(name = "GET_BUNDLE_ACTIONS_FAILED_NULL_COORD_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.status = 'FAILED' AND w.coordId IS NULL"),
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -54,9 +54,7 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "GET_BUNDLE_JOBS_COLUMNS", query = "select w.id, w.appName, w.appPath, w.conf, w.status, w.kickoffTimestamp, w.startTimestamp, w.endTimestamp, w.pauseTimestamp, w.createdTimestamp, w.user, w.group, w.timeUnitStr, w.timeOut from BundleJobBean w order by w.createdTimestamp desc"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_PENDING", query = "select OBJECT(w) from BundleJobBean w where w.pending = 1 order by w.lastModifiedTimestamp"),
-
- @NamedQuery(name = "GET_BUNDLE_JOBS_RUNNING", query = "select OBJECT(w) from BundleJobBean w where w.status = 'RUNNING' OR w.status = 'RUNNINGWITHERROR' order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_RUNNING_OR_PENDING", query = "select OBJECT(w) from BundleJobBean w where w.status = 'RUNNING' OR w.status = 'RUNNINGWITHERROR' OR w.pending = 1 order by w.lastModifiedTimestamp"),
@NamedQuery(name = "GET_BUNDLE_JOBS_NEED_START", query = "select OBJECT(w) from BundleJobBean w where w.status = 'PREP' AND (w.kickoffTimestamp IS NULL OR (w.kickoffTimestamp IS NOT NULL AND w.kickoffTimestamp <= :currentTime)) order by w.lastModifiedTimestamp"),
@@ -64,7 +62,7 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "GET_BUNDLE_JOBS_UNPAUSED", query = "select OBJECT(w) from BundleJobBean w where w.status = 'RUNNING' OR w.status = 'RUNNINGWITHERROR' OR w.status = 'PREP' order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_OLDER_THAN", query = "select OBJECT(w) from BundleJobBean w where w.startTimestamp <= :matTime AND (w.status = 'PREP' OR w.status = 'RUNNING') order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_OLDER_THAN", query = "select OBJECT(w) from BundleJobBean w where w.startTimestamp <= :matTime AND (w.status = 'PREP' OR w.status = 'RUNNING' or w.status = 'RUNNINGWITHERROR') order by w.lastModifiedTimestamp"),
@NamedQuery(name = "GET_BUNDLE_JOBS_OLDER_THAN_STATUS", query = "select OBJECT(w) from BundleJobBean w where w.status = :status AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java Fri Aug 3 07:38:00 2012
@@ -112,8 +112,8 @@ import org.apache.openjpa.persistence.jd
// Query to retrieve count of Coordinator actions which are pending
@NamedQuery(name = "GET_COORD_ACTIONS_PENDING_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending > 0"),
- // Query to retrieve status of Coordinator actions which are not pending
- @NamedQuery(name = "GET_COORD_ACTIONS_STATUS_BY_PENDING_FALSE", query = "select a.status from CoordinatorActionBean a where a.jobId = :jobId AND a.pending = 0"),
+ // Query to retrieve status of Coordinator actions
+ @NamedQuery(name = "GET_COORD_ACTIONS_STATUS", query = "select a.status from CoordinatorActionBean a where a.jobId = :jobId"),
@NamedQuery(name = "GET_COORD_ACTION_FOR_COORD_JOB_BY_ACTION_NUMBER", query = "select a.id from CoordinatorActionBean a where a.jobId = :jobId AND a.actionNumber = :actionNumber"),
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,6 +43,8 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "UPDATE_COORD_JOB_STATUS", query = "update CoordinatorJobBean w set w.status = :status, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
+ @NamedQuery(name = "UPDATE_COORD_JOB_PENDING", query = "update CoordinatorJobBean w set w.pending = :pending, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
+
@NamedQuery(name = "DELETE_COORD_JOB", query = "delete from CoordinatorJobBean w where w.id = :id"),
@NamedQuery(name = "GET_COORD_JOBS", query = "select OBJECT(w) from CoordinatorJobBean w"),
@@ -55,7 +57,7 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "GET_COORD_JOBS_COLUMNS", query = "select w.id, w.appName, w.status, w.user, w.group, w.startTimestamp, w.endTimestamp, w.appPath, w.concurrency, w.frequency, w.lastActionTimestamp, w.nextMaterializedTimestamp, w.createdTimestamp, w.timeUnitStr, w.timeZone, w.timeOut from CoordinatorJobBean w order by w.createdTimestamp desc"),
- @NamedQuery(name = "GET_COORD_JOBS_OLDER_THAN", query = "select OBJECT(w) from CoordinatorJobBean w where w.startTimestamp <= :matTime AND (w.status = 'PREP' OR w.status = 'RUNNING') AND (w.nextMaterializedTimestamp < :matTime OR w.nextMaterializedTimestamp IS NULL) AND (w.nextMaterializedTimestamp IS NULL OR (w.endTimestamp > w.nextMaterializedTimestamp AND (w.pauseTimestamp IS NULL OR w.pauseTimestamp > w.nextMaterializedTimestamp))) order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_COORD_JOBS_OLDER_THAN", query = "select OBJECT(w) from CoordinatorJobBean w where w.startTimestamp <= :matTime AND (w.status = 'PREP' OR w.status = 'RUNNING' or w.status = 'RUNNINGWITHERROR') AND (w.nextMaterializedTimestamp < :matTime OR w.nextMaterializedTimestamp IS NULL) AND (w.nextMaterializedTimestamp IS NULL OR (w.endTimestamp > w.nextMaterializedTimestamp AND (w.pauseTimestamp IS NULL OR w.pauseTimestamp > w.nextMaterializedTimestamp))) order by w.lastModifiedTimestamp"),
@NamedQuery(name = "GET_COORD_JOBS_OLDER_THAN_STATUS", query = "select OBJECT(w) from CoordinatorJobBean w where w.status = :status AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/RerunTransitionXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/RerunTransitionXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/RerunTransitionXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/RerunTransitionXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,9 @@
package org.apache.oozie.command;
import org.apache.oozie.ErrorCode;
+import org.apache.oozie.client.CoordinatorJob;
import org.apache.oozie.client.Job;
+import org.apache.oozie.util.StatusUtils;
/**
* Transition command for rerun the job. The derived class has to override these following functions:
@@ -66,7 +68,14 @@ public abstract class RerunTransitionXCo
job = this.getJob();
}
prevStatus = job.getStatus();
- job.setStatus(Job.Status.RUNNING);
+ if (prevStatus == Job.Status.SUCCEEDED || prevStatus == Job.Status.PAUSED
+ || prevStatus == Job.Status.SUSPENDED || prevStatus == Job.Status.RUNNING) {
+ job.setStatus(Job.Status.RUNNING);
+ }
+ else {
+ // Check for backward compatibility
+ job.setStatus(StatusUtils.getStatusIfBackwardSupportTrue(Job.Status.RUNNINGWITHERROR));
+ }
job.setPending();
}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/ResumeTransitionXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/ResumeTransitionXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/ResumeTransitionXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/ResumeTransitionXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,6 +52,9 @@ public abstract class ResumeTransitionXC
else if (job.getStatus() == Job.Status.SUSPENDED) {
job.setStatus(Job.Status.RUNNING);
}
+ else if (job.getStatus() == Job.Status.SUSPENDEDWITHERROR) {
+ job.setStatus(Job.Status.RUNNINGWITHERROR);
+ }
job.setPending();
}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/SuspendTransitionXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/SuspendTransitionXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/SuspendTransitionXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/SuspendTransitionXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,6 +52,9 @@ public abstract class SuspendTransitionX
else if (job.getStatus() == Job.Status.RUNNING) {
job.setStatus(Job.Status.SUSPENDED);
}
+ else if (job.getStatus() == Job.Status.RUNNINGWITHERROR){
+ job.setStatus(Job.Status.SUSPENDEDWITHERROR);
+ }
else if (job.getStatus() == Job.Status.PAUSED) {
job.setStatus(Job.Status.SUSPENDED);
}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,6 +27,7 @@ import org.apache.oozie.BundleActionBean
import org.apache.oozie.BundleJobBean;
import org.apache.oozie.ErrorCode;
import org.apache.oozie.XException;
+import org.apache.oozie.client.CoordinatorJob;
import org.apache.oozie.client.Job;
import org.apache.oozie.client.OozieClient;
import org.apache.oozie.command.CommandException;
@@ -43,6 +44,7 @@ import org.apache.oozie.util.DateUtils;
import org.apache.oozie.util.JobUtils;
import org.apache.oozie.util.LogUtils;
import org.apache.oozie.util.ParamChecker;
+import org.apache.oozie.util.StatusUtils;
public class BundleJobChangeXCommand extends XCommand<Void> {
private String jobId;
@@ -164,7 +166,12 @@ public class BundleJobChangeXCommand ext
}
else if (isChangeEndTime) {
bundleJob.setEndTime(newEndTime);
- bundleJob.setStatus(Job.Status.RUNNING);
+ if (bundleJob.getStatus() == Job.Status.SUCCEEDED) {
+ bundleJob.setStatus(Job.Status.RUNNING);
+ }
+ if (bundleJob.getStatus() == Job.Status.DONEWITHERROR || bundleJob.getStatus() == Job.Status.FAILED) {
+ bundleJob.setStatus(StatusUtils.getStatusIfBackwardSupportTrue(Job.Status.RUNNINGWITHERROR));
+ }
}
for (BundleActionBean action : this.bundleActions) {
// queue coord change commands;
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -64,7 +64,7 @@ public class BundleJobResumeXCommand ext
public void resumeChildren() throws CommandException {
try {
for (BundleActionBean action : bundleActions) {
- if (action.getStatus() == Job.Status.SUSPENDED || action.getStatus() == Job.Status.PREPSUSPENDED) {
+ if (action.getStatus() == Job.Status.SUSPENDED || action.getStatus() == Job.Status.SUSPENDEDWITHERROR || action.getStatus() == Job.Status.PREPSUSPENDED) {
// queue a CoordResumeXCommand
if (action.getCoordId() != null) {
queue(new CoordResumeXCommand(action.getCoordId()));
@@ -94,6 +94,9 @@ public class BundleJobResumeXCommand ext
else if (action.getStatus() == Job.Status.SUSPENDED) {
action.setStatus(Job.Status.RUNNING);
}
+ else if (action.getStatus() == Job.Status.SUSPENDEDWITHERROR) {
+ action.setStatus(Job.Status.RUNNINGWITHERROR);
+ }
action.incrementAndGetPending();
action.setLastModifiedTime(new Date());
try {
@@ -171,9 +174,9 @@ public class BundleJobResumeXCommand ext
*/
@Override
protected void verifyPrecondition() throws CommandException, PreconditionException {
- if (bundleJob.getStatus() != Job.Status.SUSPENDED && bundleJob.getStatus() != Job.Status.PREPSUSPENDED) {
+ if (bundleJob.getStatus() != Job.Status.SUSPENDED && bundleJob.getStatus() != Job.Status.SUSPENDEDWITHERROR && bundleJob.getStatus() != Job.Status.PREPSUSPENDED) {
throw new PreconditionException(ErrorCode.E1100, "BundleResumeCommand not Resumed - "
- + "job not in SUSPENDED/PREPSUSPENDED state " + bundleId);
+ + "job not in SUSPENDED/SUSPENDEDWITHERROR/PREPSUSPENDED state " + bundleId);
}
}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -180,6 +180,10 @@ public class BundleJobSuspendXCommand ex
else if (action.getStatus() == Job.Status.RUNNING) {
action.setStatus(Job.Status.SUSPENDED);
}
+ else if (action.getStatus() == Job.Status.RUNNINGWITHERROR) {
+ action.setStatus(Job.Status.SUSPENDEDWITHERROR);
+ }
+
action.incrementAndGetPending();
action.setLastModifiedTime(new Date());
try {
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -213,12 +213,16 @@ public class BundleRerunXCommand extends
public void updateJob() throws CommandException {
try {
// rerun a paused bundle job will keep job status at paused and pending at previous pending
- if (getPrevStatus()!= null && getPrevStatus().equals(Job.Status.PAUSED)) {
- bundleJob.setStatus(Job.Status.PAUSED);
- if (prevPending) {
- bundleJob.setPending();
- } else {
- bundleJob.resetPending();
+ if (getPrevStatus() != null) {
+ Job.Status bundleJobStatus = getPrevStatus();
+ if (bundleJobStatus.equals(Job.Status.PAUSED) || bundleJobStatus.equals(Job.Status.PAUSEDWITHERROR)) {
+ bundleJob.setStatus(bundleJobStatus);
+ if (prevPending) {
+ bundleJob.setPending();
+ }
+ else {
+ bundleJob.resetPending();
+ }
}
}
jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java Fri Aug 3 07:38:00 2012
@@ -20,6 +20,7 @@ package org.apache.oozie.command.bundle;
import java.util.Date;
import org.apache.oozie.BundleActionBean;
+import org.apache.oozie.BundleJobBean;
import org.apache.oozie.CoordinatorJobBean;
import org.apache.oozie.ErrorCode;
import org.apache.oozie.XException;
@@ -30,6 +31,8 @@ import org.apache.oozie.command.Precondi
import org.apache.oozie.command.StatusUpdateXCommand;
import org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor;
import org.apache.oozie.executor.jpa.BundleActionUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobUpdateJPAExecutor;
import org.apache.oozie.executor.jpa.JPAExecutorException;
import org.apache.oozie.service.JPAService;
import org.apache.oozie.service.Services;
@@ -72,6 +75,14 @@ public class BundleStatusUpdateXCommand
if (bundleaction.isPending()) {
bundleaction.decrementAndGetPending();
}
+ // TODO - Uncomment this when bottom up rerun can change terminal state
+ /*BundleJobBean bundleJob = jpaService.execute(new BundleJobGetJPAExecutor(bundleaction.getBundleId()));
+ if (!bundleJob.isPending()) {
+ bundleJob.setPending();
+ jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
+ LOG.info("Updated bundle job [{0}] pending to true", bundleaction.getBundleId());
+ }*/
+
bundleaction.setLastModifiedTime(new Date());
bundleaction.setCoordId(coordjob.getId());
jpaService.execute(new BundleActionUpdateJPAExecutor(bundleaction));
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java Fri Aug 3 07:38:00 2012
@@ -520,11 +520,11 @@ public class CoordActionInputCheckXComma
return;
}
- if (coordJob.getStatus() != Job.Status.RUNNING && coordJob.getStatus() != Job.Status.PAUSED
+ if (coordJob.getStatus() != Job.Status.RUNNING && coordJob.getStatus() != Job.Status.RUNNINGWITHERROR && coordJob.getStatus() != Job.Status.PAUSED
&& coordJob.getStatus() != Job.Status.PAUSEDWITHERROR) {
throw new PreconditionException(
ErrorCode.E1100, "["+ actionId + "]::CoordActionInputCheck:: Ignoring action." +
- " Coordinator job is not in RUNNING/PAUSED/PAUSEDWITHERROR state, but state="
+ " Coordinator job is not in RUNNING/RUNNINGWITHERROR/PAUSED/PAUSEDWITHERROR state, but state="
+ coordJob.getStatus());
}
}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java Fri Aug 3 07:38:00 2012
@@ -153,7 +153,7 @@ public class CoordActionReadyXCommand ex
@Override
protected void verifyPrecondition() throws CommandException, PreconditionException {
- if (coordJob.getStatus() != Job.Status.RUNNING && coordJob.getStatus() != Job.Status.SUCCEEDED && coordJob.getStatus() != Job.Status.PAUSED && coordJob.getStatus() != Job.Status.PAUSEDWITHERROR) {
+ if (coordJob.getStatus() != Job.Status.RUNNING && coordJob.getStatus() != Job.Status.RUNNINGWITHERROR && coordJob.getStatus() != Job.Status.SUCCEEDED && coordJob.getStatus() != Job.Status.PAUSED && coordJob.getStatus() != Job.Status.PAUSEDWITHERROR) {
throw new PreconditionException(ErrorCode.E1100, "[" + jobId
+ "]::CoordActionReady:: Ignoring job. Coordinator job is not in RUNNING state, but state="
+ coordJob.getStatus());
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java Fri Aug 3 07:38:00 2012
@@ -20,6 +20,7 @@ package org.apache.oozie.command.coord;
import java.util.Date;
import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.CoordinatorJobBean;
import org.apache.oozie.ErrorCode;
import org.apache.oozie.WorkflowJobBean;
import org.apache.oozie.XException;
@@ -36,6 +37,8 @@ import org.apache.oozie.command.Precondi
import org.apache.oozie.executor.jpa.CoordActionGetForExternalIdJPAExecutor;
import org.apache.oozie.executor.jpa.CoordActionUpdateJPAExecutor;
import org.apache.oozie.executor.jpa.CoordActionUpdateStatusJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
import org.apache.oozie.executor.jpa.JPAExecutorException;
public class CoordActionUpdateXCommand extends CoordinatorXCommand<Void> {
@@ -91,7 +94,12 @@ public class CoordActionUpdateXCommand e
// update lastModifiedTime
coordAction.setLastModifiedTime(new Date());
jpaService.execute(new CoordActionUpdateStatusJPAExecutor(coordAction));
-
+ // TODO - Uncomment this when bottom up rerun can change terminal state
+ /* CoordinatorJobBean coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordAction.getJobId()));
+ if (!coordJob.isPending()) {
+ coordJob.setPending();
+ jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
+ }*/
return null;
}
@@ -100,6 +108,13 @@ public class CoordActionUpdateXCommand e
coordAction.setLastModifiedTime(new Date());
jpaService.execute(new CoordActionUpdateStatusJPAExecutor(coordAction));
+ // TODO - Uncomment this when bottom up rerun can change terminal state
+ /*CoordinatorJobBean coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordAction.getJobId()));
+ if (!coordJob.isPending()) {
+ coordJob.setPending();
+ jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
+ LOG.info("Updating Coordinator job "+ coordJob.getId() + "pending to true");
+ }*/
if (slaStatus != null) {
SLADbOperations.writeStausEvent(coordAction.getSlaXml(), coordAction.getId(), slaStatus,
SlaAppType.COORDINATOR_ACTION, LOG);
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java Fri Aug 3 07:38:00 2012
@@ -45,6 +45,7 @@ import org.apache.oozie.util.DateUtils;
import org.apache.oozie.util.JobUtils;
import org.apache.oozie.util.LogUtils;
import org.apache.oozie.util.ParamChecker;
+import org.apache.oozie.util.StatusUtils;
public class CoordChangeXCommand extends CoordinatorXCommand<Void> {
private final String jobId;
@@ -289,14 +290,18 @@ public class CoordChangeXCommand extends
try {
if (newEndTime != null) {
coordJob.setEndTime(newEndTime);
- if (coordJob.getStatus() == CoordinatorJob.Status.SUCCEEDED
- || coordJob.getStatus() == CoordinatorJob.Status.RUNNING
- || coordJob.getStatus() == CoordinatorJob.Status.DONEWITHERROR
- || coordJob.getStatus() == CoordinatorJob.Status.FAILED) {
+ if (coordJob.getStatus() == CoordinatorJob.Status.SUCCEEDED){
coordJob.setStatus(CoordinatorJob.Status.RUNNING);
- coordJob.setPending();
- coordJob.resetDoneMaterialization();
}
+ if (coordJob.getStatus() == CoordinatorJob.Status.DONEWITHERROR
+ || coordJob.getStatus() == CoordinatorJob.Status.FAILED) {
+ // Check for backward compatibility for Oozie versions (3.2 and before)
+ // when RUNNINGWITHERROR, SUSPENDEDWITHERROR and
+ // PAUSEDWITHERROR is not supported
+ coordJob.setStatus(StatusUtils.getStatusIfBackwardSupportTrue(CoordinatorJob.Status.RUNNINGWITHERROR));
+ }
+ coordJob.setPending();
+ coordJob.resetDoneMaterialization();
}
if (newConcurrency != null) {
@@ -306,14 +311,23 @@ public class CoordChangeXCommand extends
if (newPauseTime != null || resetPauseTime == true) {
this.coordJob.setPauseTime(newPauseTime);
if (oldPauseTime != null && newPauseTime != null) {
- if (oldPauseTime.before(newPauseTime) && this.coordJob.getStatus() == Job.Status.PAUSED) {
- this.coordJob.setStatus(Job.Status.RUNNING);
+ if (oldPauseTime.before(newPauseTime)) {
+ if (this.coordJob.getStatus() == Job.Status.PAUSED) {
+ this.coordJob.setStatus(Job.Status.RUNNING);
+ }
+ else if (this.coordJob.getStatus() == Job.Status.PAUSEDWITHERROR) {
+ this.coordJob.setStatus(Job.Status.RUNNINGWITHERROR);
+ }
}
}
- else if (oldPauseTime != null && newPauseTime == null && this.coordJob.getStatus() == Job.Status.PAUSED) {
- this.coordJob.setStatus(Job.Status.RUNNING);
+ else if (oldPauseTime != null && newPauseTime == null) {
+ if (this.coordJob.getStatus() == Job.Status.PAUSED) {
+ this.coordJob.setStatus(Job.Status.RUNNING);
+ }
+ else if (this.coordJob.getStatus() == Job.Status.PAUSEDWITHERROR) {
+ this.coordJob.setStatus(Job.Status.RUNNINGWITHERROR);
+ }
}
-
if (!resetPauseTime) {
processLookaheadActions(coordJob, newPauseTime);
}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -174,7 +174,8 @@ public class CoordMaterializeTransitionX
*/
@Override
protected void verifyPrecondition() throws CommandException, PreconditionException {
- if (!(coordJob.getStatus() == CoordinatorJobBean.Status.PREP || coordJob.getStatus() == CoordinatorJobBean.Status.RUNNING)) {
+ if (!(coordJob.getStatus() == CoordinatorJobBean.Status.PREP || coordJob.getStatus() == CoordinatorJobBean.Status.RUNNING
+ || coordJob.getStatus() == CoordinatorJobBean.Status.RUNNINGWITHERROR)) {
throw new PreconditionException(ErrorCode.E1100, "CoordMaterializeTransitionXCommand for jobId=" + jobId
+ " job is not in PREP or RUNNING but in " + coordJob.getStatus());
}
@@ -365,8 +366,11 @@ public class CoordMaterializeTransitionX
// if the job endtime == action endtime, we don't need to materialize this job anymore
Date jobEndTime = job.getEndTime();
- LOG.info("[" + job.getId() + "]: Update status from " + job.getStatus() + " to RUNNING");
- job.setStatus(Job.Status.RUNNING);
+
+ if (job.getStatus() == CoordinatorJob.Status.PREP){
+ LOG.info("[" + job.getId() + "]: Update status from " + job.getStatus() + " to RUNNING");
+ job.setStatus(Job.Status.RUNNING);
+ }
job.setPending();
if (jobEndTime.compareTo(endMatdTime) <= 0) {
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java Fri Aug 3 07:38:00 2012
@@ -377,8 +377,12 @@ public class CoordRerunXCommand extends
public void updateJob() throws CommandException {
try {
// rerun a paused coordinator job will keep job status at paused and pending at previous pending
- if (getPrevStatus()!= null && getPrevStatus().equals(Job.Status.PAUSED)) {
- coordJob.setStatus(Job.Status.PAUSED);
+
+ if (getPrevStatus()!= null){
+ Job.Status coordJobStatus = getPrevStatus();
+ if(coordJobStatus.equals(Job.Status.PAUSED) || coordJobStatus.equals(Job.Status.PAUSEDWITHERROR)) {
+ coordJob.setStatus(coordJobStatus);
+ }
if (prevPending) {
coordJob.setPending();
} else {
@@ -404,7 +408,16 @@ public class CoordRerunXCommand extends
@Override
public final void transitToNext() {
prevStatus = coordJob.getStatus();
- coordJob.setStatus(Job.Status.RUNNING);
+ if (prevStatus == CoordinatorJob.Status.SUCCEEDED || prevStatus == CoordinatorJob.Status.PAUSED
+ || prevStatus == CoordinatorJob.Status.SUSPENDED || prevStatus == CoordinatorJob.Status.RUNNING) {
+ coordJob.setStatus(Job.Status.RUNNING);
+ }
+ else {
+ // Check for backward compatibility for Oozie versions (3.2 and before)
+ // when RUNNINGWITHERROR, SUSPENDEDWITHERROR and
+ // PAUSEDWITHERROR is not supported
+ coordJob.setStatus(StatusUtils.getStatusIfBackwardSupportTrue(CoordinatorJob.Status.RUNNINGWITHERROR));
+ }
// used for backward support of coordinator 0.1 schema
coordJob.setStatus(StatusUtils.getStatusForCoordRerun(coordJob, prevStatus));
coordJob.setPending();
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -99,9 +99,9 @@ public class CoordResumeXCommand extends
*/
@Override
protected void verifyPrecondition() throws CommandException, PreconditionException {
- if (coordJob.getStatus() != CoordinatorJob.Status.SUSPENDED && coordJob.getStatus() != Job.Status.PREPSUSPENDED) {
+ if (coordJob.getStatus() != CoordinatorJob.Status.SUSPENDED && coordJob.getStatus() != CoordinatorJob.Status.SUSPENDEDWITHERROR && coordJob.getStatus() != Job.Status.PREPSUSPENDED) {
throw new PreconditionException(ErrorCode.E1100, "CoordResumeXCommand not Resumed - "
- + "job not in SUSPENDED/PREPSUSPENDED state, job = " + jobId);
+ + "job not in SUSPENDED/SUSPENDEDWITHERROR/PREPSUSPENDED state, job = " + jobId);
}
}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -226,6 +226,9 @@ public class CoordSuspendXCommand extend
else if (coordJob.getStatus() == Job.Status.RUNNING) {
coordJob.setStatus(Job.Status.SUSPENDED);
}
+ else if (coordJob.getStatus() == Job.Status.RUNNINGWITHERROR) {
+ coordJob.setStatus(Job.Status.SUSPENDEDWITHERROR);
+ }
else if (coordJob.getStatus() == Job.Status.PAUSED) {
coordJob.setStatus(Job.Status.SUSPENDED);
}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java Fri Aug 3 07:38:00 2012
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Added: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionsGetStatusPendingJPAExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionsGetStatusPendingJPAExecutor.java?rev=1368811&view=auto
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionsGetStatusPendingJPAExecutor.java (added)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionsGetStatusPendingJPAExecutor.java Fri Aug 3 07:38:00 2012
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oozie.executor.jpa;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.BundleActionBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.client.Job;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Load the list of BundleAction return it.
+ */
+public class BundleActionsGetStatusPendingJPAExecutor implements JPAExecutor<List<BundleActionBean>> {
+
+ private String bundleId = null;
+
+ /**
+ * The constructor for class {@link BundleActionsGetStatusPendingJPAExecutor}
+ *
+ * @param bundleId bundle job id
+ */
+ public BundleActionsGetStatusPendingJPAExecutor(String bundleId) {
+ ParamChecker.notNull(bundleId, "bundleId");
+ this.bundleId = bundleId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+ */
+ @Override
+ public String getName() {
+ return "BundleActionsGetStatusPendingJPAExecutor";
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.EntityManager)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<BundleActionBean> execute(EntityManager em) throws JPAExecutorException {
+ List<BundleActionBean> baBeans = new ArrayList<BundleActionBean>();
+ try {
+ Query q = em.createNamedQuery("GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE");
+ q.setParameter("bundleId", bundleId);
+ List<Object[]> bundleActionList = q.getResultList();
+ for (Object[] a : bundleActionList) {
+ BundleActionBean bab = createBeanFromBundle(a);
+ baBeans.add(bab);
+ }
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+
+ return baBeans;
+ }
+
+ private BundleActionBean createBeanFromBundle(Object[] arr) {
+ BundleActionBean bab = new BundleActionBean();
+ if (arr[0] != null) {
+ bab.setCoordId((String) arr[0]);
+ }
+ if (arr[1] != null) {
+ bab.setStatus(Job.Status.valueOf((String) arr[1]));
+ }
+ if (arr[2] != null) {
+ bab.setPending((Integer) arr[2]);
+ }
+
+ return bab;
+ }
+
+}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetPendingJPAExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetPendingJPAExecutor.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetPendingJPAExecutor.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetPendingJPAExecutor.java Fri Aug 3 07:38:00 2012
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.oozie.BundleJobBean;
-import org.apache.oozie.ErrorCode;
-
-/**
- * Get a list of Bundle Jobs that are in pending. The result is ordered by lastModifiedTimestamp.
- */
-public class BundleJobsGetPendingJPAExecutor implements JPAExecutor<List<BundleJobBean>> {
- private int limit;
-
- public BundleJobsGetPendingJPAExecutor(int limit) {
- this.limit = limit;
- }
-
- /* (non-Javadoc)
- * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
- */
- @Override
- public String getName() {
- return "BundleJobsGetPendingJPAExecutor";
- }
-
- /* (non-Javadoc)
- * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.EntityManager)
- */
- @Override
- @SuppressWarnings("unchecked")
- public List<BundleJobBean> execute(EntityManager em) throws JPAExecutorException {
- List<BundleJobBean> bjBeans;
- List<BundleJobBean> jobList = new ArrayList<BundleJobBean>();
- try {
- Query q = em.createNamedQuery("GET_BUNDLE_JOBS_PENDING");
- if (limit > 0) {
- q.setMaxResults(limit);
- }
- bjBeans = q.getResultList();
- for (BundleJobBean j : bjBeans) {
- jobList.add(j);
- }
- }
- catch (Exception e) {
- throw new JPAExecutorException(ErrorCode.E0603, e);
- }
- return jobList;
- }
-}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningJPAExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningJPAExecutor.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningJPAExecutor.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningJPAExecutor.java Fri Aug 3 07:38:00 2012
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.oozie.BundleJobBean;
-import org.apache.oozie.ErrorCode;
-
-/**
- * Get a list of Bundle Jobs that are are RUNNING or RUNNINGWITHERROR status. The result is ordered by lastModifiedTimestamp.
- */
-public class BundleJobsGetRunningJPAExecutor implements JPAExecutor<List<BundleJobBean>> {
- private int limit;
-
- public BundleJobsGetRunningJPAExecutor(int limit) {
- this.limit = limit;
- }
-
- /* (non-Javadoc)
- * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
- */
- @Override
- public String getName() {
- return "BundleJobsGetRunningJPAExecutor";
- }
-
- /* (non-Javadoc)
- * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.EntityManager)
- */
- @Override
- @SuppressWarnings("unchecked")
- public List<BundleJobBean> execute(EntityManager em) throws JPAExecutorException {
- List<BundleJobBean> bjBeans;
- List<BundleJobBean> jobList = new ArrayList<BundleJobBean>();
- try {
- Query q = em.createNamedQuery("GET_BUNDLE_JOBS_RUNNING");
- if (limit > 0) {
- q.setMaxResults(limit);
- }
- bjBeans = q.getResultList();
- for (BundleJobBean j : bjBeans) {
- jobList.add(j);
- }
- }
- catch (Exception e) {
- throw new JPAExecutorException(ErrorCode.E0603, e);
- }
- return jobList;
- }
-}
Added: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningOrPendingJPAExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningOrPendingJPAExecutor.java?rev=1368811&view=auto
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningOrPendingJPAExecutor.java (added)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobsGetRunningOrPendingJPAExecutor.java Fri Aug 3 07:38:00 2012
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oozie.executor.jpa;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.BundleJobBean;
+import org.apache.oozie.ErrorCode;
+
+/**
+ * Get a list of Bundle Jobs that are are RUNNING or RUNNINGWITHERROR status or the pending flag is 1. The result is ordered by lastModifiedTimestamp.
+ */
+public class BundleJobsGetRunningOrPendingJPAExecutor implements JPAExecutor<List<BundleJobBean>> {
+ private int limit;
+
+ public BundleJobsGetRunningOrPendingJPAExecutor(int limit) {
+ this.limit = limit;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+ */
+ @Override
+ public String getName() {
+ return "BundleJobsGetRunningOrPendingJPAExecutor";
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.EntityManager)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<BundleJobBean> execute(EntityManager em) throws JPAExecutorException {
+ List<BundleJobBean> bjBeans;
+ List<BundleJobBean> jobList = new ArrayList<BundleJobBean>();
+ try {
+ Query q = em.createNamedQuery("GET_BUNDLE_JOBS_RUNNING_OR_PENDING");
+ if (limit > 0) {
+ q.setMaxResults(limit);
+ }
+ bjBeans = q.getResultList();
+ for (BundleJobBean j : bjBeans) {
+ jobList.add(j);
+ }
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+ return jobList;
+ }
+}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java Fri Aug 3 07:38:00 2012
@@ -1,64 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.client.CoordinatorAction;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Get the status of Coordinator actions which are not pending for a given Coordinator job
- */
-public class CoordJobGetActionsStatusByPendingFalseJPAExecutor implements JPAExecutor<List<CoordinatorAction.Status>> {
-
- private String coordJobId = null;
-
- public CoordJobGetActionsStatusByPendingFalseJPAExecutor(String coordJobId) {
- ParamChecker.notNull(coordJobId, "coordJobId");
- this.coordJobId = coordJobId;
- }
-
- @Override
- public String getName() {
- return "CoordJobGetActionsStatusByPendingFalseJPAExecutor";
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<CoordinatorAction.Status> execute(EntityManager em) throws JPAExecutorException {
- try {
- Query q = em.createNamedQuery("GET_COORD_ACTIONS_STATUS_BY_PENDING_FALSE");
- q.setParameter("jobId", coordJobId);
- List<String> coordStatusResultList = q.getResultList();
- List<CoordinatorAction.Status> coordStatus = new ArrayList<CoordinatorAction.Status>();
- for (String a : coordStatusResultList) {
- coordStatus.add(CoordinatorAction.Status.valueOf(a));
- }
- return coordStatus;
- }
- catch (Exception e) {
- throw new JPAExecutorException(ErrorCode.E0603, e);
- }
- }
-}
Added: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusJPAExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusJPAExecutor.java?rev=1368811&view=auto
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusJPAExecutor.java (added)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusJPAExecutor.java Fri Aug 3 07:38:00 2012
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oozie.executor.jpa;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.client.CoordinatorAction;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Get the status of Coordinator actions for a given Coordinator job
+ */
+public class CoordJobGetActionsStatusJPAExecutor implements JPAExecutor<List<CoordinatorAction.Status>> {
+
+ private String coordJobId = null;
+
+ public CoordJobGetActionsStatusJPAExecutor(String coordJobId) {
+ ParamChecker.notNull(coordJobId, "coordJobId");
+ this.coordJobId = coordJobId;
+ }
+
+ @Override
+ public String getName() {
+ return "CoordJobGetActionsStatusJPAExecutor";
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<CoordinatorAction.Status> execute(EntityManager em) throws JPAExecutorException {
+ try {
+ Query q = em.createNamedQuery("GET_COORD_ACTIONS_STATUS");
+ q.setParameter("jobId", coordJobId);
+ List<String> coordStatusResultList = q.getResultList();
+ List<CoordinatorAction.Status> coordStatus = new ArrayList<CoordinatorAction.Status>();
+ for (String a : coordStatusResultList) {
+ coordStatus.add(CoordinatorAction.Status.valueOf(a));
+ }
+ return coordStatus;
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+ }
+}
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java?rev=1368811&r1=1368810&r2=1368811&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java Fri Aug 3 07:38:00 2012
@@ -196,10 +196,12 @@ public class RecoveryService implements
else if (baction.getStatus() == Job.Status.KILLED) {
queueCallable(new CoordKillXCommand(baction.getCoordId()));
}
- else if (baction.getStatus() == Job.Status.SUSPENDED) {
+ else if (baction.getStatus() == Job.Status.SUSPENDED
+ || baction.getStatus() == Job.Status.SUSPENDEDWITHERROR) {
queueCallable(new CoordSuspendXCommand(baction.getCoordId()));
}
- else if (baction.getStatus() == Job.Status.RUNNING) {
+ else if (baction.getStatus() == Job.Status.RUNNING
+ || baction.getStatus() == Job.Status.RUNNINGWITHERROR) {
queueCallable(new CoordResumeXCommand(baction.getCoordId()));
}
}