helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hu...@apache.org
Subject [helix] 08/10: TASK: Fix bug in isWorkflowStopped
Date Thu, 28 Mar 2019 19:31:52 GMT
This is an automated email from the ASF dual-hosted git repository.

hulee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git

commit b9e7b5ce2d77ebfcb0f249d478aff77226d1a0b8
Author: Hunter Lee <hulee@linkedin.com>
AuthorDate: Thu Mar 28 12:29:38 2019 -0700

    TASK: Fix bug in isWorkflowStopped
    
        A bug in isWorkflowStopped was causing the workflow context for the recurrent workflow
template to show up as STOPPED. This diff fixes this so that it handles recurrent workflow
templates correctly.
---
 .../src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/helix-core/src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java b/helix-core/src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java
index b853198..a6345f6 100644
--- a/helix-core/src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java
+++ b/helix-core/src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java
@@ -1018,11 +1018,16 @@ public abstract class AbstractTaskDispatcher {
 
   /**
    * Checks if the workflow has been stopped.
+   * In the case of a recurrent workflow template, we look at its TargetState.
    * @param ctx Workflow context containing task states
    * @param cfg Workflow config containing set of tasks
    * @return returns true if all tasks are {@link TaskState#STOPPED}, false otherwise.
    */
   protected boolean isWorkflowStopped(WorkflowContext ctx, WorkflowConfig cfg) {
+    if (cfg.isRecurring()) {
+      return cfg.getTargetState() == TargetState.START;
+    }
+
     for (String job : cfg.getJobDag().getAllNodes()) {
       TaskState jobState = ctx.getJobState(job);
       if (jobState != null


Mime
View raw message