Return-Path: X-Original-To: apmail-falcon-commits-archive@minotaur.apache.org Delivered-To: apmail-falcon-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9501D18785 for ; Wed, 6 Jan 2016 10:53:14 +0000 (UTC) Received: (qmail 78525 invoked by uid 500); 6 Jan 2016 10:53:14 -0000 Delivered-To: apmail-falcon-commits-archive@falcon.apache.org Received: (qmail 78476 invoked by uid 500); 6 Jan 2016 10:53:14 -0000 Mailing-List: contact commits-help@falcon.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@falcon.apache.org Delivered-To: mailing list commits@falcon.apache.org Received: (qmail 78466 invoked by uid 99); 6 Jan 2016 10:53:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jan 2016 10:53:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4AE67DFBE6; Wed, 6 Jan 2016 10:53:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pallavi@apache.org To: commits@falcon.apache.org Date: Wed, 06 Jan 2016 10:53:17 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [4/9] falcon git commit: FALCON-1674 Fix the mapping of InstanceState status to workflow Status in InstancesResult. Contributed by Pallavi Rao. FALCON-1674 Fix the mapping of InstanceState status to workflow Status in InstancesResult. Contributed by Pallavi Rao. Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/679167a2 Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/679167a2 Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/679167a2 Branch: refs/heads/0.9 Commit: 679167a24508994c5b4128162f856c2385de0df2 Parents: 1e3dcb7 Author: Ajay Yadava Authored: Tue Jan 5 13:44:03 2016 +0530 Committer: Ajay Yadava Committed: Tue Jan 5 13:44:03 2016 +0530 ---------------------------------------------------------------------- CHANGES.txt | 2 + docs/src/site/twiki/restapi/InstanceList.twiki | 10 ++++ .../workflow/engine/OozieWorkflowEngine.java | 5 +- .../workflow/engine/FalconWorkflowEngine.java | 49 ++++++++++++++++---- 4 files changed, 56 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/679167a2/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 9c59ed6..1d3aa02 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -90,6 +90,8 @@ Proposed Release Version: 0.9 OPTIMIZATIONS BUG FIXES + FALCON-1674 Fix the mapping of InstanceState status to workflow Status in InstancesResult (Pallavi Rao via Ajay Yadava) + FALCON-1709 FIFO order is not followed when scheduled using native scheduler (Pallavi Rao) FALCON-1711 DependencyInstance twiki does not contain correct documentation (Praveen Adlakha via Pallavi Rao) http://git-wip-us.apache.org/repos/asf/falcon/blob/679167a2/docs/src/site/twiki/restapi/InstanceList.twiki ---------------------------------------------------------------------- diff --git a/docs/src/site/twiki/restapi/InstanceList.twiki b/docs/src/site/twiki/restapi/InstanceList.twiki index 229d6f9..5dee8a5 100644 --- a/docs/src/site/twiki/restapi/InstanceList.twiki +++ b/docs/src/site/twiki/restapi/InstanceList.twiki @@ -29,6 +29,16 @@ Get list of all instances of a given entity. ---++ Results List of instances of given entity. +The possible instance status returned and its meaning are as follows: + * WAITING - The instance is waiting for the corresponding data(feed) instances to become available. + * READY - The instance is ready to be scheduled. But, is waiting for scheduling conditions to be met. For example, limitation on number of instances that can be run in parallel. + * RUNNING - The instance is running on the workflow engine. + * FAILED - The instance has failed during execution. + * KILLED - The instance has been killed either manually or by the system. + * SUCCEEDED - The instance has executed successfully. + * SKIPPED - This instance was not executed, but was skipped. For example, when the execution order is LAST_ONLY, the older instances are skipped. + * ERROR - There was error while executing this instance on the workflow engine. + * UNDEFINED - The status of the instance could not be determined. ---++ Examples ---+++ Rest Call http://git-wip-us.apache.org/repos/asf/falcon/blob/679167a2/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 b486357..cf0e30d 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 @@ -953,8 +953,9 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine { } private String mapActionStatus(String status) { - if (CoordinatorAction.Status.READY.toString().equals(status) - || CoordinatorAction.Status.WAITING.toString().equals(status) + if (CoordinatorAction.Status.READY.toString().equals(status)) { + return InstancesResult.WorkflowStatus.READY.name(); + } else if (CoordinatorAction.Status.WAITING.toString().equals(status) || CoordinatorAction.Status.SUBMITTED.toString().equals(status)) { return InstancesResult.WorkflowStatus.WAITING.name(); } else if (CoordinatorAction.Status.IGNORED.toString().equals(status)) { http://git-wip-us.apache.org/repos/asf/falcon/blob/679167a2/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java ---------------------------------------------------------------------- diff --git a/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java b/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java index bceab72..8306b34 100644 --- a/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java +++ b/scheduler/src/main/java/org/apache/falcon/workflow/engine/FalconWorkflowEngine.java @@ -27,6 +27,7 @@ import org.apache.falcon.entity.v0.Entity; import org.apache.falcon.entity.v0.EntityType; import org.apache.falcon.entity.v0.SchemaHelper; import org.apache.falcon.entity.v0.cluster.Cluster; +import org.apache.falcon.exception.StateStoreException; import org.apache.falcon.execution.EntityExecutor; import org.apache.falcon.execution.ExecutionInstance; import org.apache.falcon.execution.FalconExecutionService; @@ -267,23 +268,19 @@ public class FalconWorkflowEngine extends AbstractWorkflowEngine { switch(action) { case KILL: executor.kill(instance); - instanceInfo.status = InstancesResult.WorkflowStatus.KILLED; + populateInstanceInfo(instanceInfo, instance); break; case SUSPEND: executor.suspend(instance); - instanceInfo.status = InstancesResult.WorkflowStatus.SUSPENDED; + populateInstanceInfo(instanceInfo, instance); break; case RESUME: executor.resume(instance); - instanceInfo.status = - InstancesResult.WorkflowStatus.valueOf(STATE_STORE - .getExecutionInstance(instance.getId()).getCurrentState().name()); + populateInstanceInfo(instanceInfo, instance); break; case RERUN: executor.rerun(instance, userProps, isForced); - instanceInfo.status = - InstancesResult.WorkflowStatus.valueOf(STATE_STORE - .getExecutionInstance(instance.getId()).getCurrentState().name()); + populateInstanceInfo(instanceInfo, instance); break; case STATUS: // Mask wfParams @@ -293,6 +290,9 @@ public class FalconWorkflowEngine extends AbstractWorkflowEngine { DAGEngineFactory.getDAGEngine(cluster).getJobDetails(instance.getExternalID()); instanceInfo.actions = instanceActions .toArray(new InstancesResult.InstanceAction[instanceActions.size()]); + // If not scheduled externally yet, get details from state + } else { + populateInstanceInfo(instanceInfo, instance); } break; @@ -313,6 +313,39 @@ public class FalconWorkflowEngine extends AbstractWorkflowEngine { return instanceInfo; } + // Populates the InstancesResult.Instance instance using ExecutionInstance + private void populateInstanceInfo(InstancesResult.Instance instanceInfo, ExecutionInstance instance) + throws StateStoreException { + instanceInfo.cluster = instance.getCluster(); + InstanceState.STATE state = STATE_STORE.getExecutionInstance(instance.getId()).getCurrentState(); + switch (state) { + case SUCCEEDED: + instanceInfo.status = InstancesResult.WorkflowStatus.SUCCEEDED; + break; + case FAILED: + instanceInfo.status = InstancesResult.WorkflowStatus.FAILED; + break; + case KILLED: + instanceInfo.status = InstancesResult.WorkflowStatus.KILLED; + break; + case READY: + instanceInfo.status = InstancesResult.WorkflowStatus.READY; + break; + case WAITING: + instanceInfo.status = InstancesResult.WorkflowStatus.WAITING; + break; + case SUSPENDED: + instanceInfo.status = InstancesResult.WorkflowStatus.SUSPENDED; + break; + case RUNNING: + instanceInfo.status = InstancesResult.WorkflowStatus.RUNNING; + break; + default: + instanceInfo.status = InstancesResult.WorkflowStatus.UNDEFINED; + break; + } + } + @Override public InstancesResult killInstances(Entity entity, Date start, Date end, Properties props, List lifeCycles) throws FalconException {