SIMPLE vs USER_DEFINED task types, and registering custom system tasks?
In the docs and examples, regular worker tasks are listed with type "SIMPLE". However, within https://github.com/Netflix/conductor/blob/master/common/src/main/java/com/netflix/conductor/common/metadata/workflow/TaskType.java, "SIMPLE" tasks are registered as system tasks. I also noticed there is another type, "USER_DEFINED" which is not registered as a system task.
-
What is the difference between "SIMPLE" and "USER_DEFINED"? Which should we use for worker task definitions?
-
Is it possible to define custom system tasks without having to modify
TaskType.java? The wiki implies that we only need to define a new mapper and hook it up inCoreModule.java, but the logic inDeciderServicewon't actually call this mapper unless our task is registered as a system task: https://github.com/Netflix/conductor/blob/612cfef6bdd580fe6feb0fe081b34fc54f0b3ace/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java#L543
if (TaskType.isSystemTask(type)) {
taskType = TaskType.valueOf(type);
}
.
.
.
List<Task> tasks = taskMappers.get(taskType.name()).getMappedTasks(taskMapperContext).stream()
.
The reason I'm asking about 2) is that it seems like we would have to fork conductor and modify conductor-common in order to register our own custom system task and mapper.
Thanks!
@kyle--lee "USER_DEFINED" task type was introduced as a fallback task type for use internally, which has been called out here.
- Please use "SIMPLE" task type for worker task in your workflow definitions.
- Yes, it is possible to add your custom system tasks. You would need to extend WorkflowSystemTask with your custom implementation and follow the steps here.
@apanicker-nflx thanks - I'll use SIMPLE type tasks.
For 2 - I saw the steps listed in the docs, but it seems like we also need to add our system task to the TaskType enum in order for the mapper to be called? this is because the DeciderService first does an isSystemTask() call against the task type string, and then does taskMappers.get(taskType.name()). Is this incorrect? It seems that whatever mapper registered will not actually ever be used unless we also add our system task to the TaskType enum.
Thanks!