getTaskExecutor method
TaskExecutor<TaskConfiguration> ?
getTaskExecutor(
- String studyDeploymentId,
- TaskConfiguration task
Returns the TaskExecutor for task in studyDeploymentId.
Executors are keyed by task name. Creates one if needed: a BackgroundTaskExecutor, AppTaskExecutor or
FunctionTaskExecutor depending on the task type.
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];
}