Set workflow id by given workflow name when workflow id is missing from workflowconfig
Project: http://git-wip-us.apache.org/repos/asf/helix/repo Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/5807fba3 Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/5807fba3 Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/5807fba3 Branch: refs/heads/master Commit: 5807fba3a3874d232437d37f01de685134971a6e Parents: c73f692 Author: Junkai Xue <j...@linkedin.com> Authored: Wed Aug 30 13:41:58 2017 -0700 Committer: Junkai Xue <j...@linkedin.com> Committed: Mon Nov 6 17:07:17 2017 -0800 ---------------------------------------------------------------------- helix-core/src/main/java/org/apache/helix/task/TaskDriver.java | 4 ++++ .../src/main/java/org/apache/helix/task/WorkflowConfig.java | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/helix/blob/5807fba3/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 ecbe06c..d298844 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 @@ -166,6 +166,10 @@ public class TaskDriver { * @param newWorkflowConfig */ public void updateWorkflow(String workflow, WorkflowConfig newWorkflowConfig) { + if (newWorkflowConfig.getWorkflowId() == null) { + newWorkflowConfig.getRecord() + .setSimpleField(WorkflowConfig.WorkflowConfigProperty.WorkflowID.name(), workflow); + } if (workflow == null || !workflow.equals(newWorkflowConfig.getWorkflowId())) { throw new HelixException(String .format("Workflow name {%s} does not match the workflow Id from WorkflowConfig {%s}", http://git-wip-us.apache.org/repos/asf/helix/blob/5807fba3/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java ---------------------------------------------------------------------- diff --git a/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java b/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java index b02fc8c..aa24d75 100644 --- a/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java +++ b/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java @@ -608,10 +608,6 @@ public class WorkflowConfig extends ResourceConfig { } private void validate() { - if (_workflowId == null) { - throw new HelixException("Workflow ID is required field!"); - } - _taskDag.validate(); if (_expiry < 0) {