21.64. Class TaskTable
Namespace: ArmoniK.Core.Adapters.MongoDB
Assembly: ArmoniK.Core.Adapters.MongoDB.dll
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
public class TaskTable : ITaskTable, IInitializable, IHealthCheckProvider
21.64.1. Inheritance
21.64.2. Implements
ITaskTable, IInitializable, IHealthCheckProvider
21.64.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
21.64.4. Extension Methods
TaskTableExtensions.AcquireTask(ITaskTable, TaskData, CancellationToken), TaskTableExtensions.BulkUpdateTasks(ITaskTable, IEnumerable<(string taskId, UpdateDefinition<TaskData> updates)>, CancellationToken), TaskTableExtensions.CancelSessionAsync(ITaskTable, string, CancellationToken), TaskTableExtensions.CancelTaskAsync(ITaskTable, ICollection<string>, CancellationToken), TaskTableExt.CancelTasks(ITaskTable, TaskFilter, CancellationToken), TaskTableExt.CountTasksAsync(ITaskTable, TaskFilter, CancellationToken), TaskTableExtensions.EndTaskAsync(ITaskTable, TaskData, TaskStatus, string?, CancellationToken), TaskTableExtensions.FinalizeTaskCreation(ITaskTable, ICollection<string>, bool, CancellationToken), TaskTableExtensions.GetParentTaskIds(ITaskTable, string, CancellationToken), TaskTableExtensions.GetTaskOutput(ITaskTable, string, CancellationToken), TaskTableExtensions.GetTaskStatus(ITaskTable, IEnumerable<string>, CancellationToken), TaskTableExtensions.GetTaskStatus(ITaskTable, string, CancellationToken), TaskTableExtensions.GetTasksExpectedOutputKeys(ITaskTable, IEnumerable<string>, CancellationToken), TaskTableExt.ListTasksAsync(ITaskTable, TaskFilter, CancellationToken), TaskTableExtensions.ReadTaskAsync(ITaskTable, string, CancellationToken), TaskTableExtensions.ReleaseTask(ITaskTable, TaskData, bool, CancellationToken), TaskTableExtensions.RetryTask(ITaskTable, TaskData, CancellationToken), TaskTableExtensions.StartTask(ITaskTable, TaskData, CancellationToken), TaskTableExt.UpdateAllTaskStatusAsync(ITaskTable, TaskFilter, TaskStatus, CancellationToken)
21.64.5. Constructors
21.64.5.1. TaskTable(SessionProvider, MongoCollectionProvider<TaskData, TaskDataModelMapping>, ILogger<TaskTable>, ActivitySource, TableStorage)
public TaskTable(SessionProvider sessionProvider, MongoCollectionProvider<TaskData, TaskDataModelMapping> taskCollectionProvider, ILogger<TaskTable> logger, ActivitySource activitySource, TableStorage option)
21.64.5.1.1. Parameters
sessionProvider SessionProvider
taskCollectionProvider MongoCollectionProvider<TaskData, TaskDataModelMapping>
activitySource ActivitySource
option TableStorage
21.64.6. Properties
21.64.6.1. Logger
Logger for class ITaskTable
public ILogger Logger { get; }
21.64.6.1.1. Property Value
21.64.6.2. PollingDelayMax
Upper bound delay between two data base accesses when active polling is employed to wait for a task status to change
public TimeSpan PollingDelayMax { get; set; }
21.64.6.2.1. Property Value
21.64.6.3. PollingDelayMin
Lower bound delay between two data base accesses when active polling is employed to wait for a task status to change
public TimeSpan PollingDelayMin { get; set; }
21.64.6.3.1. Property Value
21.64.7. Methods
21.64.7.1. Check(HealthCheckTag)
Checks the status of a class for the given health check type.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
21.64.7.1.1. Parameters
tag HealthCheckTag
Health check for which the class has to answer.
21.64.7.1.2. Returns
The result of the check containing the status of the class for the health check type.
21.64.7.2. CountAllTasksAsync(TaskStatus, CancellationToken)
Count tasks matching a given status
public Task<int> CountAllTasksAsync(TaskStatus status, CancellationToken cancellationToken = default)
21.64.7.2.1. Parameters
status TaskStatus
Status of the tasks to be counted
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.2.2. Returns
The number of tasks that matched the status
21.64.7.3. CountPartitionTasksAsync(CancellationToken)
Count tasks matching a given filter and group by partition and status
public Task<IEnumerable<PartitionTaskStatusCount>> CountPartitionTasksAsync(CancellationToken cancellationToken = default)
21.64.7.3.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.3.2. Returns
Task<IEnumerable<PartitionTaskStatusCount>>
The number of tasks that matched the filter grouped by partition and status
21.64.7.4. CountTasksAsync(Expression<Func<TaskData, bool>>, CancellationToken)
Count tasks matching a given filter
public Task<IEnumerable<TaskStatusCount>> CountTasksAsync(Expression<Func<TaskData, bool>> filter, CancellationToken cancellationToken = default)
21.64.7.4.1. Parameters
filter Expression<Func<TaskData, bool>>
Filter expression describing the tasks to be counted
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.4.2. Returns
Task<IEnumerable<TaskStatusCount>>
The number of tasks that matched the filter
21.64.7.5. CreateTasks(IEnumerable<TaskData>, CancellationToken)
Inserts a collection of tasks in the data base
public Task CreateTasks(IEnumerable<TaskData> tasks, CancellationToken cancellationToken = default)
21.64.7.5.1. Parameters
tasks IEnumerable<TaskData>
Collection of tasks to be inserted
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.5.2. Returns
Task representing the asynchronous execution of the method
21.64.7.6. DeleteTaskAsync(string, CancellationToken)
Remove a task from the data base given its id
public Task DeleteTaskAsync(string id, CancellationToken cancellationToken = default)
21.64.7.6.1. Parameters
id string
Id of the tasks to be deleted
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.6.2. Returns
Task representing the asynchronous execution of the method
21.64.7.7. DeleteTasksAsync(string, CancellationToken)
Remove tasks from the data base given their session id
public Task DeleteTasksAsync(string sessionId, CancellationToken cancellationToken = default)
21.64.7.7.1. Parameters
sessionId string
Id of the session from which tasks should be deleted
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.7.2. Returns
Task representing the asynchronous execution of the method
21.64.7.8. FindTasksAsync<T>(Expression<Func<TaskData, bool>>, Expression<Func<TaskData, T>>, CancellationToken)
Find all tasks matching the given filter and ordering
public IAsyncEnumerable<T> FindTasksAsync<T>(Expression<Func<TaskData, bool>> filter, Expression<Func<TaskData, T>> selector, CancellationToken cancellationToken = default)
21.64.7.8.1. Parameters
filter Expression<Func<TaskData, bool>>
Filter to select tasks
selector Expression<Func<TaskData, T>>
Expression to select part of the returned task data
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.8.2. Returns
Task metadata matching the request and total number of results without paging
21.64.7.8.3. Type Parameters
T
21.64.7.9. Init(CancellationToken)
Executes an initialization process for the class
public Task Init(CancellationToken cancellationToken)
21.64.7.9.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.9.2. Returns
Task representing the asynchronous execution of the method
21.64.7.10. ListApplicationsAsync(Expression<Func<TaskData, bool>>, ICollection<Expression<Func<Application, object?>>>, bool, int, int, CancellationToken)
List all applications extracted from task metadata matching the given filter and ordering
public Task<(IEnumerable<Application> applications, int totalCount)> ListApplicationsAsync(Expression<Func<TaskData, bool>> filter, ICollection<Expression<Func<Application, object?>>> orderFields, bool ascOrder, int page, int pageSize, CancellationToken cancellationToken = default)
21.64.7.10.1. Parameters
filter Expression<Func<TaskData, bool>>
Filter to select tasks
orderFields ICollection<Expression<Func<Application, object?>>>
Select the fields that will be used to order the tasks
ascOrder bool
Is the order ascending
page int
The page of results to retrieve
pageSize int
The number of results pages
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.10.2. Returns
Task<(IEnumerable<Application> applications, int totalCount)>
Collection of applications metadata matching the request and total number of results without paging
21.64.7.11. ListTasksAsync<T>(Expression<Func<TaskData, bool>>, Expression<Func<TaskData, object?>>, Expression<Func<TaskData, T>>, bool, int, int, CancellationToken)
List all tasks matching the given filter and ordering
public Task<(IEnumerable<T> tasks, long totalCount)> ListTasksAsync<T>(Expression<Func<TaskData, bool>> filter, Expression<Func<TaskData, object?>> orderField, Expression<Func<TaskData, T>> selector, bool ascOrder, int page, int pageSize, CancellationToken cancellationToken = default)
21.64.7.11.1. Parameters
filter Expression<Func<TaskData, bool>>
Filter to select tasks
orderField Expression<Func<TaskData, object?>>
Select the field that will be used to order the tasks
selector Expression<Func<TaskData, T>>
Expression to select part of the returned task data
ascOrder bool
Is the order ascending
page int
The page of results to retrieve
pageSize int
The number of results pages
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.11.2. Returns
Task<(IEnumerable<T> tasks, long totalCount)>
Collection of task metadata matching the request and total number of results without paging
21.64.7.11.3. Type Parameters
T
21.64.7.11.4. Remarks
If pageSize is 0, this function can be used to count the number of tasks
satisfying the condition specified by filter
21.64.7.12. ReadTaskAsync<T>(string, Expression<Func<TaskData, T>>, CancellationToken)
Retrieves a task from the data base
public Task<T> ReadTaskAsync<T>(string taskId, Expression<Func<TaskData, T>> selector, CancellationToken cancellationToken = default)
21.64.7.12.1. Parameters
taskId string
Id of the task to read
selector Expression<Func<TaskData, T>>
Expression to select part of the returned task data
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.12.2. Returns
Task<T>
Task metadata of the retrieved task
21.64.7.12.3. Type Parameters
T
21.64.7.13. RemoveRemainingDataDependenciesAsync<T>(ICollection<string>, ICollection<string>, Expression<Func<TaskData, T>>, CancellationToken)
Remove data dependencies from remaining data dependencies, and returns tasks that are ready
public IAsyncEnumerable<T> RemoveRemainingDataDependenciesAsync<T>(ICollection<string> taskIds, ICollection<string> dependenciesToRemove, Expression<Func<TaskData, T>> selector, CancellationToken cancellationToken = default)
21.64.7.13.1. Parameters
taskIds ICollection<string>
Tasks
dependenciesToRemove ICollection<string>
Dependencies
selector Expression<Func<TaskData, T>>
Expression to select part of the returned task data
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.13.2. Returns
Projected tasks that are ready after the dependencies removal
21.64.7.13.3. Type Parameters
T
21.64.7.14. UpdateManyTasks(Expression<Func<TaskData, bool>>, UpdateDefinition<TaskData>, CancellationToken)
Update the tasks matching the filter with the given new values
public Task<long> UpdateManyTasks(Expression<Func<TaskData, bool>> filter, UpdateDefinition<TaskData> updates, CancellationToken cancellationToken = default)
21.64.7.14.1. Parameters
filter Expression<Func<TaskData, bool>>
Filter to select the tasks to update
updates UpdateDefinition<TaskData>
Collection of fields to update and their new value
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.14.2. Returns
The number of task matched
21.64.7.15. UpdateOneTask(string, Expression<Func<TaskData, bool>>?, UpdateDefinition<TaskData>, bool, CancellationToken)
Update one task with the given new values
public Task<TaskData?> UpdateOneTask(string taskId, Expression<Func<TaskData, bool>>? filter, UpdateDefinition<TaskData> updates, bool before, CancellationToken cancellationToken = default)
21.64.7.15.1. Parameters
taskId string
Id of the tasks to be updated
filter Expression<Func<TaskData, bool>>?
Additional filter on the task
updates UpdateDefinition<TaskData>
Collection of fields to update and their new value
before bool
Whether to return metadata before update
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.64.7.15.2. Returns
The task metadata before the update or null if task not found