getTaskExecutor method
TaskExecutor<TaskConfiguration> ?
getTaskExecutor(
- String studyDeploymentId,
- TaskConfiguration task
Get the TaskExecutor for a task based on the task name. If the task
executor does not exist, a new one is created based on the type of the task.
Returns null if the type of task is unknown.
Implementation
TaskExecutor? getTaskExecutor(
String studyDeploymentId,
TaskConfiguration task,
) {
if (_taskExecutors[studyDeploymentId]?[task.name] == null) {
TaskExecutor? executor = switch (task) {
BackgroundTask() => BackgroundTaskExecutor(),
AppTask() => AppTaskExecutor(),
FunctionTask() => FunctionTaskExecutor(),
_ => null,
};
if (executor != null) {
_taskExecutors[studyDeploymentId] = {};
_taskExecutors[studyDeploymentId]?[task.name] = executor;
}
}
return _taskExecutors[studyDeploymentId]?[task.name];
}