26.171. Class Agent

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

Represents the internal processing requests received by the agent. Provides methods to process those requests

public sealed class Agent : IAgent, IDisposable

26.171.1. Inheritance

objectAgent

26.171.2. Implements

IAgent, IDisposable

26.171.3. Inherited Members

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

26.171.4. Constructors

26.171.4.1. Agent(ISubmitter, IObjectStorage, IPushQueueStorage, IResultTable, ITaskTable, SessionData, TaskData, string, string, ILogger)

Initializes a new instance of the

public Agent(ISubmitter submitter, IObjectStorage objectStorage, IPushQueueStorage pushQueueStorage, IResultTable resultTable, ITaskTable taskTable, SessionData sessionData, TaskData taskData, string folder, string token, ILogger logger)

26.171.4.1.1. Parameters

submitter ISubmitter

Interface to manage tasks

objectStorage IObjectStorage

Interface class to manage tasks data

pushQueueStorage IPushQueueStorage

Interface to put tasks in the queue

resultTable IResultTable

Interface to manage result states

taskTable ITaskTable

Interface to manage task states

sessionData SessionData

OpaqueId of the session

taskData TaskData

OpaqueId of the task

folder string

Shared folder between Agent and Worker

token string

Token send to the worker to identify the running task

logger ILogger

Logger used to produce logs for this class

26.171.5. Properties

26.171.5.1. CreatedResultIds

Gets the collection of identifiers for results that were created (and their data are available) during the operation.

public ICollection<string> CreatedResultIds { get; }

26.171.5.1.1. Property Value

ICollection<string>

26.171.5.2. Folder

Folder in which data are sent between agent and worker

public string Folder { get; }

26.171.5.2.1. Property Value

string

26.171.5.3. SessionId

Id of the session from the task associated to the agent

public string SessionId { get; }

26.171.5.3.1. Property Value

string

26.171.5.4. Token

Unique token to identify agent and requests it should process

public string Token { get; }

26.171.5.4.1. Property Value

string

26.171.6. Methods

26.171.6.1. CreateResults(string, IEnumerable<(ResultCreationRequest request, ReadOnlyMemory<byte> data)>, CancellationToken)

Create a result (with data and metadata)

public Task<ICollection<Result>> CreateResults(string token, IEnumerable<(ResultCreationRequest request, ReadOnlyMemory<byte> data)> requests, CancellationToken cancellationToken)

26.171.6.1.1. Parameters

token string

Worker token for request validation

requests IEnumerable<(ResultCreationRequest request, ReadOnlyMemory<byte> data)>

Requests containing the result to create and their data

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.171.6.1.2. Returns

Task<ICollection<Result>>

Reply sent to the worker with the id of the created result

26.171.6.2. CreateResultsAndSubmitChildTasksAsync(CancellationToken)

Create and populate results and submit child tasks after the parent task succeeds

public Task CreateResultsAndSubmitChildTasksAsync(CancellationToken cancellationToken)

26.171.6.2.1. Parameters

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.171.6.2.2. Returns

Task

Task representing the asynchronous execution of the method

26.171.6.2.3. Exceptions

ArmoniKException

26.171.6.3. CreateResultsMetaData(string, IEnumerable<ResultCreationRequest>, CancellationToken)

Create results metadata

public Task<ICollection<Result>> CreateResultsMetaData(string token, IEnumerable<ResultCreationRequest> requests, CancellationToken cancellationToken)

26.171.6.3.1. Parameters

token string

Worker token for request validation

requests IEnumerable<ResultCreationRequest>

Requests containing the results to create

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.171.6.3.2. Returns

Task<ICollection<Result>>

Reply sent to the worker with the created results

26.171.6.4. Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

26.171.6.5. GetCommonData(string, string, CancellationToken)

Get Common data from data storage as file in shared folder

public Task<string> GetCommonData(string token, string resultId, CancellationToken cancellationToken)

26.171.6.5.1. Parameters

token string

Worker token for request validation

resultId string

Result id to retrieve

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.171.6.5.2. Returns

Task<string>

Id of the result sent to the worker

26.171.6.6. GetDirectData(string, string, CancellationToken)

Get Direct data from user as file in shared folder

public Task<string> GetDirectData(string token, string resultId, CancellationToken cancellationToken)

26.171.6.6.1. Parameters

token string

Worker token for request validation

resultId string

Result id to retrieve

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.171.6.6.2. Returns

Task<string>

Id of the result sent to the worker

26.171.6.7. GetResourceData(string, string, CancellationToken)

Get Resource data from data storage as file in shared folder

public Task<string> GetResourceData(string token, string resultId, CancellationToken cancellationToken)

26.171.6.7.1. Parameters

token string

Worker token for request validation

resultId string

Result id to retrieve

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.171.6.7.2. Returns

Task<string>

Id of the result sent to the worker

26.171.6.8. NotifyResultData(string, ICollection<string>, CancellationToken)

Put the results created as a file in the task into object storage

public Task<ICollection<string>> NotifyResultData(string token, ICollection<string> resultIds, CancellationToken cancellationToken)

26.171.6.8.1. Parameters

token string

Worker token for request validation

resultIds ICollection<string>

Results to put in the object storage

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.171.6.8.2. Returns

Task<ICollection<string>>

Results which notification is successful

26.171.6.9. SubmitTasks(ICollection<TaskSubmissionRequest>, TaskOptions?, string, string, CancellationToken)

Submit tasks with payload already existing

public Task<ICollection<TaskCreationRequest>> SubmitTasks(ICollection<TaskSubmissionRequest> requests, TaskOptions? taskOptions, string sessionId, string token, CancellationToken cancellationToken)

26.171.6.9.1. Parameters

requests ICollection<TaskSubmissionRequest>

Requests containing the tasks to submit

taskOptions TaskOptions?

Options to apply to the tasks

sessionId string

Session id to which the tasks belong

token string

Worker token for request validation

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.171.6.9.2. Returns

Task<ICollection<TaskCreationRequest>>

Submitted tasks to send to the worker