helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject [6/9] helix git commit: [HELIX-646] DeleteJob from a recurrent job queue should not throw exception if last scheduled queue not exist
Date Mon, 19 Dec 2016 17:54:16 GMT
[HELIX-646] DeleteJob from a recurrent job queue should not throw exception if last scheduled
queue not exist

When delete a job from recurrent jobqueue, it will delete job from last scheduled one and
recurrent template. But the last scheduled one could not started or expired, thus we should
ignore the fail of deletion.


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/a8d54e32
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/a8d54e32
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/a8d54e32

Branch: refs/heads/helix-0.6.x
Commit: a8d54e32cb74d6b5d9702d4d27005498b8dc43e0
Parents: 1563338
Author: Junkai Xue <jxue@linkedin.com>
Authored: Thu Dec 15 16:57:19 2016 -0800
Committer: Junkai Xue <jxue@linkedin.com>
Committed: Thu Dec 15 16:57:19 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/helix/task/TaskDriver.java    | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/a8d54e32/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java b/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
index da861f5..4fd3966 100644
--- a/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
+++ b/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
@@ -368,7 +368,7 @@ public class TaskDriver {
       String lastScheduledQueue = wCtx.getLastScheduledSingleWorkflow();
 
       // delete the current scheduled one
-      deleteJobFromScheduledQueue(lastScheduledQueue, jobName);
+      deleteJobFromScheduledQueue(lastScheduledQueue, jobName, true);
 
       // Remove the job from the original queue template's DAG
       removeJobFromDag(queueName, jobName);
@@ -383,7 +383,7 @@ public class TaskDriver {
               .join(TaskConstants.REBALANCER_CONTEXT_ROOT, namespacedJobName);
       _propertyStore.remove(jobPropertyPath, AccessOption.PERSISTENT);
     } else {
-      deleteJobFromScheduledQueue(queueName, jobName);
+      deleteJobFromScheduledQueue(queueName, jobName, false);
     }
   }
 
@@ -393,12 +393,18 @@ public class TaskDriver {
    * @param queueName
    * @param jobName
    */
-  private void deleteJobFromScheduledQueue(final String queueName, final String jobName)
{
-    WorkflowConfig workflowCfg =
-        TaskUtil.getWorkflowCfg(_accessor, queueName);
+  private void deleteJobFromScheduledQueue(final String queueName, final String jobName,
+      boolean isRecurrent) {
+    WorkflowConfig workflowCfg = TaskUtil.getWorkflowCfg(_accessor, queueName);
 
     if (workflowCfg == null) {
-      throw new IllegalArgumentException("Queue " + queueName + " does not yet exist!");
+      // When try to delete recurrent job, it could be either not started or finished. So
+      // there may not be a workflow config.
+      if (isRecurrent) {
+        return;
+      } else {
+        throw new IllegalArgumentException("Queue " + queueName + " does not yet exist!");
+      }
     }
 
     WorkflowContext wCtx = TaskUtil.getWorkflowContext(_propertyStore, queueName);


Mime
View raw message