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

Misc enhancements #3593

Merged
merged 3 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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