Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3593 from v1r3n/start_workflow_task_domain
Browse files Browse the repository at this point in the history
Misc enhancements
  • Loading branch information
v1r3n authored May 16, 2023
2 parents 4e70d59 + 7f1f1e0 commit ee94b89
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package com.netflix.conductor.core.execution.tasks;

import java.util.HashMap;
import java.util.Map;

import javax.validation.Validator;
Expand Down Expand Up @@ -65,6 +66,13 @@ public void start(
return;
}

if (request.getTaskToDomain() == null || request.getTaskToDomain().isEmpty()) {
Map<String, String> workflowTaskToDomainMap = workflow.getTaskToDomain();
if (workflowTaskToDomainMap != null) {
request.setTaskToDomain(new HashMap<>(workflowTaskToDomainMap));
}
}

// set the correlation id of starter workflow, if its empty in the StartWorkflowRequest
request.setCorrelationId(
StringUtils.defaultIfBlank(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
import com.netflix.conductor.model.WorkflowModel;

import static com.netflix.conductor.common.metadata.tasks.TaskType.TASK_TYPE_TERMINATE;
import static com.netflix.conductor.common.run.Workflow.WorkflowStatus.COMPLETED;
import static com.netflix.conductor.common.run.Workflow.WorkflowStatus.FAILED;
import static com.netflix.conductor.common.run.Workflow.WorkflowStatus.*;

/**
* Task that can terminate a workflow with a given status and modify the workflow's output with a
Expand Down Expand Up @@ -94,7 +93,9 @@ public static String getTerminationWorkflowOutputParameter() {
}

public static Boolean validateInputStatus(String status) {
return COMPLETED.name().equals(status) || FAILED.name().equals(status);
return COMPLETED.name().equals(status)
|| FAILED.name().equals(status)
|| TERMINATED.name().equals(status);
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,9 @@ private boolean isWaitTaskValid(
}

try {
if (StringUtils.isNotBlank(duration)
&& !(duration.startsWith("${") && duration.endsWith("}"))) {
if (StringUtils.isNotBlank(duration) && !(duration.startsWith("${"))) {
DateTimeUtils.parseDuration(duration);
} else if (StringUtils.isNotBlank(until)
&& !(until.startsWith("${") && until.endsWith("}"))) {
} else if (StringUtils.isNotBlank(until) && !(until.startsWith("${"))) {
DateTimeUtils.parseDate(until);
}
} catch (DateTimeParseException e) {
Expand Down

0 comments on commit ee94b89

Please sign in to comment.