26.180. Interface IAgent

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

Interface for implementing methods for the agent gRPC service that receives requests from the worker

public interface IAgent : IDisposable

26.180.1. Implements

IDisposable

26.180.2. Properties

26.180.2.1. CreatedResultIds

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

ICollection<string> CreatedResultIds { get; }

26.180.2.1.1. Property Value

ICollection<string>

26.180.2.2. Folder

Folder in which data are sent between agent and worker

string Folder { get; }

26.180.2.2.1. Property Value

string

26.180.2.3. SessionId

Id of the session from the task associated to the agent

string SessionId { get; }

26.180.2.3.1. Property Value

string

26.180.2.4. Token

Unique token to identify agent and requests it should process

string Token { get; }

26.180.2.4.1. Property Value

string

26.180.3. Methods

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

Create a result (with data and metadata)

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

26.180.3.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.180.3.1.2. Returns

Task<ICollection<Result>>

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

26.180.3.2. CreateResultsAndSubmitChildTasksAsync(CancellationToken)

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

Task CreateResultsAndSubmitChildTasksAsync(CancellationToken cancellationToken)

26.180.3.2.1. Parameters

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.180.3.2.2. Returns

Task

Task representing the asynchronous execution of the method

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

Create results metadata

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

26.180.3.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.180.3.3.2. Returns

Task<ICollection<Result>>

Reply sent to the worker with the created results

26.180.3.4. GetCommonData(string, string, CancellationToken)

Get Common data from data storage as file in shared folder

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

26.180.3.4.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.180.3.4.2. Returns

Task<string>

Id of the result sent to the worker

26.180.3.5. GetDirectData(string, string, CancellationToken)

Get Direct data from user as file in shared folder

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

26.180.3.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.180.3.5.2. Returns

Task<string>

Id of the result sent to the worker

26.180.3.6. GetResourceData(string, string, CancellationToken)

Get Resource data from data storage as file in shared folder

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

26.180.3.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.180.3.6.2. Returns

Task<string>

Id of the result sent to the worker

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

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

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

26.180.3.7.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.180.3.7.2. Returns

Task<ICollection<string>>

Results which notification is successful

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

Submit tasks with payload already existing

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

26.180.3.8.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.180.3.8.2. Returns

Task<ICollection<TaskCreationRequest>>

Submitted tasks to send to the worker