You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ha...@apache.org on 2015/02/05 02:06:44 UTC
oozie git commit: OOZIE-2109. Possibly incorrect ID may be printed
for map-reduce action errors. Contributed by Harsh J.
Repository: oozie
Updated Branches:
refs/heads/master b5a4e06ba -> c48c1a643
OOZIE-2109. Possibly incorrect ID may be printed for map-reduce action errors. Contributed by Harsh J.
Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/c48c1a64
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/c48c1a64
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/c48c1a64
Branch: refs/heads/master
Commit: c48c1a643eab036b2a8ecf7fe6ff4f90e5c22478
Parents: b5a4e06
Author: Harsh J <ha...@cloudera.com>
Authored: Sun Jan 11 02:04:24 2015 +0530
Committer: Harsh J <ha...@cloudera.com>
Committed: Thu Feb 5 06:36:31 2015 +0530
----------------------------------------------------------------------
.../oozie/action/hadoop/JavaActionExecutor.java | 11 +++++++++-
.../action/hadoop/MapReduceActionExecutor.java | 22 +++++++++++++-------
2 files changed, 24 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oozie/blob/c48c1a64/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
index 7beac5c..3383522 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
@@ -1270,6 +1270,15 @@ public class JavaActionExecutor extends ActionExecutor {
return runningJob;
}
+ /**
+ * Useful for overriding in actions that do subsequent job runs
+ * such as the MapReduce Action, where the launcher job is not the
+ * actual job that then gets monitored.
+ */
+ protected String getActualExternalId(WorkflowAction action) {
+ return action.getExternalId();
+ }
+
@Override
public void check(Context context, WorkflowAction action) throws ActionExecutorException {
JobClient jobClient = null;
@@ -1285,7 +1294,7 @@ public class JavaActionExecutor extends ActionExecutor {
context.setExecutionData(FAILED, null);
throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "JA017",
"Could not lookup launched hadoop Job ID [{0}] which was associated with " +
- " action [{1}]. Failing this action!", action.getExternalId(), action.getId());
+ " action [{1}]. Failing this action!", getActualExternalId(action), action.getId());
}
if (runningJob.isComplete()) {
Path actionDir = context.getActionDir();
http://git-wip-us.apache.org/repos/asf/oozie/blob/c48c1a64/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
index 004adf9..de8290e 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java
@@ -67,6 +67,18 @@ public class MapReduceActionExecutor extends JavaActionExecutor {
}
@Override
+ protected String getActualExternalId(WorkflowAction action) {
+ String launcherJobId = action.getExternalId();
+ String childId = action.getExternalChildIDs();
+
+ if (childId != null && !childId.isEmpty()) {
+ return childId;
+ } else {
+ return launcherJobId;
+ }
+ }
+
+ @Override
protected String getLauncherMain(Configuration launcherConf, Element actionXml) {
String mainClass;
Namespace ns = actionXml.getNamespace();
@@ -325,15 +337,9 @@ public class MapReduceActionExecutor extends JavaActionExecutor {
protected RunningJob getRunningJob(Context context, WorkflowAction action, JobClient jobClient) throws Exception{
RunningJob runningJob;
- String launcherJobId = action.getExternalId();
- String childJobId = action.getExternalChildIDs();
+ String jobId = getActualExternalId(action);
- if (childJobId != null && childJobId.length() > 0) {
- runningJob = jobClient.getJob(JobID.forName(childJobId));
- }
- else {
- runningJob = jobClient.getJob(JobID.forName(launcherJobId));
- }
+ runningJob = jobClient.getJob(JobID.forName(jobId));
return runningJob;
}