21.230. Class TaskLifeCycleHelper
Namespace: ArmoniK.Core.Common.Storage
Assembly: ArmoniK.Core.Common.dll
public static class TaskLifeCycleHelper
21.230.1. Inheritance
21.230.2. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
21.230.3. Methods
21.230.3.1. CompleteTaskAsync(ITaskTable, IResultTable, IObjectStorage, IPushQueueStorage, Submitter, TaskData, SessionData, bool, Output, ILogger, CancellationToken)
Complete the task depending on the given output
public static Task CompleteTaskAsync(ITaskTable taskTable, IResultTable resultTable, IObjectStorage objectStorage, IPushQueueStorage pushQueueStorage, Submitter options, TaskData taskData, SessionData sessionData, bool resubmit, Output output, ILogger logger, CancellationToken cancellationToken = default)
21.230.3.1.1. Parameters
taskTable ITaskTable
Interface to manage task states
resultTable IResultTable
Interface to manage result states
objectStorage IObjectStorage
Interface to manage object data
pushQueueStorage IPushQueueStorage
Interface to push messages to the queue
options Submitter
Submitter options
taskData TaskData
Data of the task
sessionData SessionData
Data of the session
resubmit bool
Whether the task should be retried in case of error
output Output
Whether the task has completed successfully
logger ILogger
Logger
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.230.3.1.2. Returns
The status of the processed task
21.230.3.2. CreateTasks(ITaskTable, IResultTable, string, string, ICollection<TaskCreationRequest>, ILogger, CancellationToken)
Initiate task creation
public static Task CreateTasks(ITaskTable taskTable, IResultTable resultTable, string sessionId, string parentTaskId, ICollection<TaskCreationRequest> taskCreationRequests, ILogger logger, CancellationToken cancellationToken = default)
21.230.3.2.1. Parameters
taskTable ITaskTable
Interface to manage task states
resultTable IResultTable
Interface to manage result states
sessionId string
Session Id of the completed results
parentTaskId string
Id of the tasks that creates the tasks
taskCreationRequests ICollection<TaskCreationRequest>
Tasks to create
logger ILogger
Logger used to produce logs
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.230.3.2.2. Returns
Task representing the asynchronous execution of the method
21.230.3.3. FinalizeTaskCreation(ITaskTable, IResultTable, IPushQueueStorage, ICollection<TaskCreationRequest>, SessionData, string, ILogger, CancellationToken)
Finalize task creation
public static Task FinalizeTaskCreation(ITaskTable taskTable, IResultTable resultTable, IPushQueueStorage pushQueueStorage, ICollection<TaskCreationRequest> taskRequests, SessionData sessionData, string parentTaskId, ILogger logger, CancellationToken cancellationToken = default)
21.230.3.3.1. Parameters
taskTable ITaskTable
Interface to manage task states
resultTable IResultTable
Interface to manage result states
pushQueueStorage IPushQueueStorage
Interface to push tasks in the queue
taskRequests ICollection<TaskCreationRequest>
Tasks requests to finalize
sessionData SessionData
Session data of the completed results
parentTaskId string
Id of the tasks that creates the tasks
logger ILogger
Logger used to produce logs
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.230.3.3.2. Returns
Task representing the asynchronous execution of the method
21.230.3.4. HandleTaskCrashedWhileProcessing(ITaskTable, IResultTable, IObjectStorage, IPushQueueStorage, Submitter, TimeSpan, SessionData, TaskData, ILogger, CancellationToken)
Either finish completion of task if crashing pod was advanced enough, or retry task otherwise
public static Task<TaskStatus> HandleTaskCrashedWhileProcessing(ITaskTable taskTable, IResultTable resultTable, IObjectStorage objectStorage, IPushQueueStorage pushQueueStorage, Submitter options, TimeSpan processingCrashedDelay, SessionData sessionData, TaskData taskData, ILogger logger, CancellationToken cancellationToken)
21.230.3.4.1. Parameters
taskTable ITaskTable
Interface to manage task states
resultTable IResultTable
Interface to manage result states
objectStorage IObjectStorage
Interface to manage object data
pushQueueStorage IPushQueueStorage
Interface to push messages to the queue
options Submitter
Submitter options
processingCrashedDelay TimeSpan
The delay after the agent has verified the other agent crashed before retrying the task
sessionData SessionData
Data of the session
taskData TaskData
Data of the task
logger ILogger
Logger
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.230.3.4.2. Returns
The status of the processed task
21.230.3.5. PauseAsync(ITaskTable, ISessionTable, string, CancellationToken)
Pause session and its paused tasks
public static Task<SessionData> PauseAsync(ITaskTable taskTable, ISessionTable sessionTable, string sessionId, CancellationToken cancellationToken = default)
21.230.3.5.1. Parameters
taskTable ITaskTable
Interface to manage task states
sessionTable ISessionTable
Interface to manage session states
sessionId string
Id of the session to pause
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.230.3.5.2. Returns
The updated data of the session
21.230.3.6. ResolveDependencies(ITaskTable, IResultTable, IPushQueueStorage, SessionData, ICollection<string>, ILogger, CancellationToken)
Remove completed results from dependent tasks and submit tasks which dependencies are completed
public static Task ResolveDependencies(ITaskTable taskTable, IResultTable resultTable, IPushQueueStorage pushQueueStorage, SessionData sessionData, ICollection<string> results, ILogger logger, CancellationToken cancellationToken = default)
21.230.3.6.1. Parameters
taskTable ITaskTable
Interface to manage task states
resultTable IResultTable
Interface to manage result states
pushQueueStorage IPushQueueStorage
Interface to push tasks in the queue
sessionData SessionData
Session data of the completed results
results ICollection<string>
Collection of completed results
logger ILogger
Logger used to produce logs
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.230.3.6.2. Returns
Task representing the asynchronous execution of the method
21.230.3.7. ResumeAsync(ITaskTable, ISessionTable, IPushQueueStorage, string, CancellationToken)
Resume session and its paused tasks
public static Task<SessionData> ResumeAsync(ITaskTable taskTable, ISessionTable sessionTable, IPushQueueStorage pushQueueStorage, string sessionId, CancellationToken cancellationToken = default)
21.230.3.7.1. Parameters
taskTable ITaskTable
Interface to manage task states
sessionTable ISessionTable
Interface to manage session states
pushQueueStorage IPushQueueStorage
Interface to push tasks in the queue
sessionId string
Id of the session to resume
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.230.3.7.2. Returns
The updated data of the session
21.230.3.8. ValidateSession(SessionData, TaskOptions?, string, int, ILogger, CancellationToken)
Validate and merge task data from the session with the given options
public static TaskOptions ValidateSession(SessionData sessionData, TaskOptions? submissionOptions, string parentTaskId, int maxPriority, ILogger logger, CancellationToken cancellationToken)
21.230.3.8.1. Parameters
sessionData SessionData
Session Metadata
submissionOptions TaskOptions?
Incoming task options
parentTaskId string
Id of the tasks that creates the tasks
maxPriority int
Max priority managed by the queue
logger ILogger
Logger used to produce logs
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.230.3.8.2. Returns
TaskOptions
Merged task options
21.230.3.8.3. Exceptions
when partition in incoming tasks options is not allowed in the session