public IAsyncEnumerable <(ITask, ILease)> PollDynamicTaskAsync(IDynamicTask task, CancellationToken cancellationToken) { var result = Array.Empty <(ITask, ILease)>(); lock (_syncRoot) { if (_dynamicTasks.TryGetValue(task, out var taskInstances)) { result = taskInstances.Select(task => (task, (ILease) new Lease())).ToArray(); } } return(result.ToAsyncEnumerable()); }
public IAsyncEnumerable <(ITask, ILease)> PollDynamicTaskAsync(IDynamicTask task, CancellationToken cancellationToken) { throw new NotImplementedException(); }
public ITask CreateTaskInstance(IDynamicTask template, string name, TaskConfiguration taskConfiguration) { return(new DynamicTaskInstance(template, name, taskConfiguration)); }
public async Task UnscheduleTask(IDynamicTask baseTask, string taskInstanceName, CancellationToken cancellationToken) { var dynamicTaskInstance = _taskInstanceFactory.CreateTaskInstance(baseTask, taskInstanceName, TaskConfiguration.Default); await _repository.UnregistrerTaskAsync(dynamicTaskInstance, cancellationToken).ConfigureAwait(false); }
public DynamicTaskInstance(IDynamicTask parentTask, string instanceName, TaskConfiguration configuration) { ParentTask = parentTask ?? throw new ArgumentNullException(nameof(parentTask)); Name = instanceName ?? throw new ArgumentNullException(nameof(instanceName)); Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); }
public static string GetCanonicalName(this IDynamicTask task) { return(task.Name.Replace(":", "::")); }