21.228. Class TaskLifeCycleHelper

Namespace: ArmoniK.Core.Common.Storage
Assembly: ArmoniK.Core.Common.dll

public static class TaskLifeCycleHelper

21.228.1. Inheritance

objectTaskLifeCycleHelper

21.228.2. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

21.228.3. Methods

21.228.3.1. 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.228.3.1.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.228.3.1.2. Returns

Task

Task representing the asynchronous execution of the method

21.228.3.2. 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.228.3.2.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.228.3.2.2. Returns

Task

Task representing the asynchronous execution of the method

21.228.3.3. 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.228.3.3.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.228.3.3.2. Returns

Task<SessionData>

The updated data of the session

21.228.3.4. 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.228.3.4.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.228.3.4.2. Returns

Task

Task representing the asynchronous execution of the method

21.228.3.5. 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.228.3.5.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.228.3.5.2. Returns

Task<SessionData>

The updated data of the session

21.228.3.6. 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.228.3.6.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.228.3.6.2. Returns

TaskOptions

Merged task options

21.228.3.6.3. Exceptions

InvalidOperationException

when partition in incoming tasks options is not allowed in the session