diff --git a/common/src/main/java/com/netflix/conductor/common/metadata/workflow/SubWorkflowParams.java b/common/src/main/java/com/netflix/conductor/common/metadata/workflow/SubWorkflowParams.java index d17378862..ce4fe4fd8 100644 --- a/common/src/main/java/com/netflix/conductor/common/metadata/workflow/SubWorkflowParams.java +++ b/common/src/main/java/com/netflix/conductor/common/metadata/workflow/SubWorkflowParams.java @@ -46,7 +46,7 @@ public class SubWorkflowParams { private IdempotencyStrategy idempotencyStrategy; // Priority of the sub workflow, not set inherits from the parent - private Integer priority; + private Object priority; public String getIdempotencyKey() { return idempotencyKey; @@ -64,11 +64,11 @@ public void setIdempotencyStrategy(IdempotencyStrategy idempotencyStrategy) { this.idempotencyStrategy = idempotencyStrategy; } - public Integer getPriority() { + public Object getPriority() { return priority; } - public void setPriority(Integer priority) { + public void setPriority(Object priority) { this.priority = priority; } diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/SubWorkflowTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/SubWorkflowTaskMapper.java index fae54660b..3b4630c7c 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/SubWorkflowTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/SubWorkflowTaskMapper.java @@ -14,6 +14,7 @@ import java.util.*; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -77,14 +78,17 @@ public List getMappedTasks(TaskMapperContext taskMapperContext) { TaskModel subWorkflowTask = taskMapperContext.createTaskModel(); subWorkflowTask.setTaskType(TASK_TYPE_SUB_WORKFLOW); subWorkflowTask.addInput("subWorkflowName", subWorkflowName); + subWorkflowTask.addInput("priority", resolvedParams.get("priority")); subWorkflowTask.addInput("subWorkflowVersion", subWorkflowVersion); subWorkflowTask.addInput("subWorkflowTaskToDomain", subWorkflowTaskToDomain); subWorkflowTask.addInput("subWorkflowDefinition", subWorkflowDefinition); subWorkflowTask.addInput("workflowInput", taskMapperContext.getTaskInput()); subWorkflowTask.setStatus(TaskModel.Status.SCHEDULED); subWorkflowTask.setCallbackAfterSeconds(workflowTask.getStartDelay()); - if (subWorkflowParams.getPriority() != null) { - subWorkflowTask.setWorkflowPriority(subWorkflowParams.getPriority()); + if (subWorkflowParams.getPriority() != null + && !StringUtils.isEmpty(subWorkflowParams.getPriority().toString())) { + int priority = Integer.parseInt(subWorkflowParams.getPriority().toString()); + subWorkflowTask.setWorkflowPriority(priority); } LOGGER.debug("SubWorkflowTask {} created to be Scheduled", subWorkflowTask); return List.of(subWorkflowTask); @@ -109,6 +113,7 @@ private Map getSubWorkflowInputParameters( WorkflowModel workflowModel, SubWorkflowParams subWorkflowParams) { Map params = new HashMap<>(); params.put("name", subWorkflowParams.getName()); + params.put("priority", subWorkflowParams.getPriority()); Integer version = subWorkflowParams.getVersion(); if (version != null) {