public async Task TaskStarted() { var taskId = await allocator.PushTaskAsync(new TestTask()); var executorId = await allocator.SubscribeAsync(metadataManager.Tasks.Select(it => it.TaskName).ToArray()); await allocator.WaitTasksAsync(executorId); Assert.NotEmpty(taskRepository.Tasks); Assert.Contains(taskRepository.TaskIds, it => it == taskId); var task = taskRepository.Tasks.Single(); Assert.NotNull(task.Execution); Assert.Equal(TaskExecutionStatus.Started, task.Execution.Status); Assert.Equal(executorId, task.Execution.ExecutorId); }
public async Task ConnectAsync(CancellationToken cancellationToken) { logger.LogInformation($"Connecting executor..."); ExecutorId = await taskAllocator.SubscribeAsync(handlerFactories.Values.Select(it => it.TaskName).ToArray(), cancellationToken); logger.LogInformation($"Subscribed executor {ExecutorId}."); }