Repository: falcon Updated Branches: refs/heads/master 37848ed65 -> 6610f36b1
FALCON-2067 In instance status list, -allAttempts does not show all runs After the fix: `$ bin/falcon instance -status -type process -name oozie-mr-process -start 2013-11-15T00:00Z -allAttempts Consolidated Status: SUCCEEDED Instances: Instance Cluster SourceCluster Status Start End Details Log ----------------------------------------------------------------------------------------------- 2013-11-15T00:05Z local - READY - - - - 2013-11-15T00:05Z local - KILLED 2016-07-14T05:53Z 2016-07-14T05:53Z - http://IM1738M1:11000/oozie?job=0000006-160713101246755-oozie-oozi-W actions: user-action ERROR null 2013-11-15T00:05Z local - KILLED 2016-07-14T05:48Z 2016-07-14T05:51Z - http://IM1738M1:11000/oozie?job=0000003-160713101246755-oozie-oozi-W actions: user-action ERROR null failed-post-processing KILLED http://localhost:8088/proxy/application_1468321868387_0012/ 2013-11-15T00:10Z local - READY - - - - 2013-11-15T00:10Z local - KILLED 2016-07-14T05:45Z 2016-07-14T05:48Z - http://IM1738M1:11000/oozie?job=0000004-160713101246755-oozie-oozi-W actions: user-action ERROR null failed-post-processing KILLED http://localhost:8088/proxy/application_1468321868387_0011/ 2013-11-15T00:15Z local - KILLED - - - - 2013-11-15T00:20Z local - KILLED - - - - 2013-11-15T00:25Z local - KILLED - - - - 2013-11-15T00:30Z local - KILLED - - - - 2013-11-15T00:35Z local - KILLED - - - -` Author: Pallavi Rao <[email protected]> Reviewers: @peeyushb, @PraveenAdlakha Closes #226 from pallavi-rao/2067 and squashes the following commits: 06980e6 [Pallavi Rao] FALCON-2067 Updated patch to return Oozie workflow id, rather than coord id 39aa1e5 [Pallavi Rao] FALCON-2067 In instance status list, -allAttempts does not show all runs Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/6610f36b Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/6610f36b Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/6610f36b Branch: refs/heads/master Commit: 6610f36b131f53b7bb89c40a9f91b2a57bd585af Parents: 37848ed Author: Pallavi Rao <[email protected]> Authored: Thu Jul 14 16:41:51 2016 +0530 Committer: Pallavi Rao <[email protected]> Committed: Thu Jul 14 16:41:51 2016 +0530 ---------------------------------------------------------------------- .../workflow/engine/OozieWorkflowEngine.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/6610f36b/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java ---------------------------------------------------------------------- diff --git a/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java b/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java index c35f607..ecbe7ee 100644 --- a/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java +++ b/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java @@ -694,9 +694,9 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine { if (action.equals(JobAction.STATUS) && Boolean.TRUE.equals(allAttempts)) { try { performAction(cluster, action, coordinatorAction, props, instance, isForced); - if (instance.getRunId() > 0) { - instanceList = getAllInstances(cluster, coordinatorAction, nominalTimeStr); - } else { + instanceList = getAllInstances(cluster, coordinatorAction, nominalTimeStr); + // Happens when the action is in READY/WAITING, when no workflow is kicked off yet. + if (instanceList.isEmpty() || StringUtils.isBlank(coordinatorAction.getExternalId())) { instanceList.add(instance); } } catch (FalconException e) { @@ -883,8 +883,8 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine { private List<InstancesResult.Instance> getAllInstances(String cluster, CoordinatorAction coordinatorAction, String nominalTimeStr) throws FalconException { List<InstancesResult.Instance> instanceList = new ArrayList<>(); - if (StringUtils.isNotBlank(coordinatorAction.getExternalId())) { - List<WorkflowJob> workflowJobList = getWfsForCoordAction(cluster, coordinatorAction.getExternalId()); + if (StringUtils.isNotBlank(coordinatorAction.getId())) { + List<WorkflowJob> workflowJobList = getWfsForCoordAction(cluster, coordinatorAction.getId()); if (workflowJobList != null && workflowJobList.size()>0) { for (WorkflowJob workflowJob : workflowJobList) { InstancesResult.Instance newInstance = new InstancesResult.Instance(cluster, nominalTimeStr, null); @@ -892,7 +892,7 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine { if (wfJob!=null) { newInstance.startTime = wfJob.getStartTime(); newInstance.endTime = wfJob.getEndTime(); - newInstance.logFile = getConsoleUrl(cluster, coordinatorAction.getId()); + newInstance.logFile = wfJob.getConsoleUrl(); populateInstanceActions(cluster, wfJob, newInstance); newInstance.status = WorkflowStatus.valueOf(mapActionStatus(wfJob.getStatus().name())); instanceList.add(newInstance); @@ -912,7 +912,7 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine { status = jobInfo.getStatus().name(); instance.startTime = jobInfo.getStartTime(); instance.endTime = jobInfo.getEndTime(); - instance.logFile = getConsoleUrl(cluster, coordinatorAction.getId()); + instance.logFile = jobInfo.getConsoleUrl(); instance.runId = jobInfo.getRun(); } @@ -984,11 +984,6 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine { } } - // This method is required as the console URL returned by Oozie for Coord Action is NULL - private String getConsoleUrl(String cluster, String actionId) throws FalconException { - return OozieClientFactory.get(cluster).getOozieUrl() + "?job=" + actionId; - } - public CoordinatorAction.Status reRunCoordAction(String cluster, CoordinatorAction coordinatorAction, Properties props, boolean isForced) throws FalconException { try {
