Show / Hide Table of Contents

Class WorkerExecutor

A backend-independent execution manager class used by a WorkerHost to execute a task WorkUnit using a product-specific instance of an IWorker.

  • Is back-end host agnostic - Backend independent library i.e. no knowledge or dependencies upon any Azure Batch.

  • Is OneCompute library aware.

  • Is application independent - product specific unaware.

Inheritance
System.Object
WorkerExecutor
Implements
IWorkerExecutionStatusNotificationService
IDisposable
Namespace: DNVGL.One.Compute.WorkerHost.Services
Assembly: DNVGL.One.Compute.WorkerHost.dll
Syntax
public class WorkerExecutor : IWorkerExecutor

Constructors

View Source

WorkerExecutor(WorkUnit, IWorker, CancellationToken, IWorkItemStatusService, IFlowModelStorageService<Result>, IFileTransferService, Func<IWorkerHostResultLakeClient>, ILogger)

Initializes a new instance of the WorkerExecutor class.

Declaration
public WorkerExecutor(WorkUnit unit, IWorker worker, CancellationToken cancellationToken, IWorkItemStatusService workItemStatusService, IFlowModelStorageService<Result> flowModelStorageService, IFileTransferService fileTransferService, Func<IWorkerHostResultLakeClient> resultLakeClientFactory, ILogger logger)
Parameters
Type Name Description
WorkUnit unit

The unit.

IWorker worker

The worker.

CancellationToken cancellationToken

The cancellation token.

IWorkItemStatusService workItemStatusService

The work item status service.

IFlowModelStorageService<Result> flowModelStorageService

The flow model storage service.

IFileTransferService fileTransferService

The file transfer service.

Func<IWorkerHostResultLakeClient> resultLakeClientFactory

The result lake client factory.

ILogger logger

The logger.

Properties

View Source

FileTransferService

Gets the file transfer service.

Declaration
public IFileTransferService FileTransferService { get; }
Property Value
Type Description
IFileTransferService
View Source

Logger

Gets the logger service.

Declaration
public ILogger Logger { get; }
Property Value
Type Description
ILogger
View Source

NumberOfResultLakeRequestRetries

Gets or sets the number of retries of Result Lake requests.

Declaration
public int NumberOfResultLakeRequestRetries { get; set; }
Property Value
Type Description
System.Int32

The number of Result Lake request retries.

View Source

ResultLakeRequestRetryInterval

Gets or sets the retry interval for the Result Lake client (time between each retry).

Declaration
public TimeSpan ResultLakeRequestRetryInterval { get; set; }
Property Value
Type Description
TimeSpan

The retry interval.

Methods

View Source

AddOrUpdateWorkItemResult(Object)

Declaration
public void AddOrUpdateWorkItemResult(object workUnitResult)
Parameters
Type Name Description
System.Object workUnitResult
View Source

AddWorkItemStatus(WorkStatus, Double, String)

An IWorkerExecutor method to be used by the product specific task worker model to report the progress/status of the task work unit.

Declaration
public void AddWorkItemStatus(WorkStatus status, double progress, string message)
Parameters
Type Name Description
WorkStatus status

The work item status.

System.Double progress

The progress.

System.String message

The message.

Remarks

The actual persistence of status using the work item status service is done in a background task, run by DNVGL.One.Compute.WorkerHost.Services.WorkerExecutor.DoPendingStatusUpdates.

View Source

ExecuteAsync()

Means for the worker host to trigger the execution of the task work unit. The work unit is passed into the worker executor through the constructor.

Declaration
public async Task<object> ExecuteAsync()
Returns
Type Description
Task<System.Object>

The result of the task - which is a product-specific object.

Implements

IWorkerExecutionStatusNotificationService
IDisposable
  • View Source
In This Article
Back to top Copyright © DNV AS. All rights reserved.