Show / Hide Table of Contents

Class WorkUnit

Models atomic (non-decomposable) work.

Inheritance
object
FlowModelObject
WorkItem
WorkUnit
Implements
IFlowModelItem
IWorkUnit
IExecutableWorkContainer
Inherited Members
WorkItem.Tag
WorkItem.JobId
WorkItem.ParentId
WorkItem.Id
WorkItem.GetParent()
WorkItem.Select<T>(Func<WorkItem, T>)
WorkItem.Traverse(Action<WorkItem, WorkItem>, WorkItem)
WorkItem.FindItems(Func<WorkItem, bool>, bool)
WorkItem.OnInitialize(Job)
WorkItem.ToString()
FlowModelObject.BatchNumber
FlowModelObject.Properties
FlowModelObject.PropertiesContent
FlowModelObject.this[string]
FlowModelObject.UpdateProperties(string)
FlowModelObject.UpdateProperties(FlowModelObject)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: DNVGL.One.Compute.Core.FlowModel
Assembly: DNVGL.One.Compute.Core.dll
Syntax
[DataContract]
public class WorkUnit : WorkItem, IFlowModelItem, IWorkUnit, IExecutableWorkContainer

Constructors

View Source

WorkUnit()

Initializes a new instance of the WorkUnit class.

Declaration
public WorkUnit()
View Source

WorkUnit(object, WorkItem, ISerializationContext)

Initializes a new instance of the WorkUnit class.

Declaration
public WorkUnit(object input, WorkItem executableWork, ISerializationContext serializationContext = null)
Parameters
Type Name Description
object input

The input to the work unit.

WorkItem executableWork

The executable work.

ISerializationContext serializationContext

Serialization context for the input.

View Source

WorkUnit(object, ISerializationContext)

Initializes a new instance of the WorkUnit class.

Declaration
public WorkUnit(object input, ISerializationContext serializationContext = null)
Parameters
Type Name Description
object input

The input to the work unit.

ISerializationContext serializationContext

Serialization context for the input.

Properties

View Source

Alias

Gets the alias for this work unit.

Declaration
public string Alias { get; }
Property Value
Type Description
string
View Source

Command

Gets or sets the command-line used by the backend to process this work unit (optional).

Declaration
[DataMember]
public string Command { get; set; }
Property Value
Type Description
string

The command-line for processing this work unit.

Remarks

This is an optional property. If set, it will be transmitted literally to the backend. It is backend specific. For an Azure Batch backend, this command line should start with cmd /c (Windows) or /bin/sh (Linux).

View Source

Dependencies

Gets or sets the dependencies.

Declaration
[DataMember]
public List<string> Dependencies { get; set; }
Property Value
Type Description
List<string>

The dependencies.

Remarks

List of ids of WorkUnits that this work unit depends on.

View Source

ExecutablePath

Gets or sets the relative path of the executable containing the worker(s) processing this work unit.

Declaration
[DataMember]
public string ExecutablePath { get; set; }
Property Value
Type Description
string

Relative path of the executable to run on the backend.

Remarks

This is a relative path to the executable containing the application worker(s) used to process this work unit. The path is relative to the deployment root directory of the application.

View Source

InputFileSpecifications

Gets or sets the input file specifications.

Declaration
[DataMember]
public FileTransferSpecification[] InputFileSpecifications { get; set; }
Property Value
Type Description
FileTransferSpecification[]

The input file specifications.

View Source

InputFiles

Gets or sets the resources.

Declaration
[DataMember]
public List<string> InputFiles { get; set; }
Property Value
Type Description
List<string>

The resources.

View Source

OutputFileSpecifications

Gets or sets the output file specifications.

Declaration
[DataMember]
public FileTransferSpecification[] OutputFileSpecifications { get; set; }
Property Value
Type Description
FileTransferSpecification[]

The output file specifications.

View Source

Request

Gets or sets the application request.

Declaration
[DataMember]
public string Request { get; set; }
Property Value
Type Description
string

The application request.

Remarks

This property can be used by the client application to communicate an application specific request to the application worker. It is not used by One Compute.

View Source

SchedulerId

Gets or sets the scheduler identifier.

Declaration
public string SchedulerId { get; set; }
Property Value
Type Description
string

The scheduler identifier.

View Source

ServiceName

Gets or sets the name of the service.

Declaration
[DataMember]
public string ServiceName { get; set; }
Property Value
Type Description
string

The name of the service.

Remarks

In the context of OneCompute Platform, this is the name of the application. If set, this value will override ServiceName set on the job. In general, it is recommended to set ServiceName and only set ServiceName for work that must be done by a different application.

View Source

StatusUpdateFrequency

Gets or sets the status update frequency in seconds.

Declaration
public int StatusUpdateFrequency { get; set; }
Property Value
Type Description
int
View Source

TaskRole

Gets or sets the task role of the work unit.

Declaration
[DataMember]
public TaskRoles TaskRole { get; set; }
Property Value
Type Description
TaskRoles

The task role.

View Source

WorkerAssemblyFileName

Gets or sets the file name of the assembly that exposes the IWorker export contract that will be loaded by the worker host.

Declaration
[DataMember]
public string WorkerAssemblyFileName { get; set; }
Property Value
Type Description
string

The name of the assembly that exposes the IWorker export contract or null as default.

Remarks

Optionally, the specific name of the assembly to be loaded as the IWorker. This prevents MEF doing a sweep of the entire working directory and is useful to limit the scope of the MEF container. It is valid to leave this field as null. In which case MEF will load all assemblies in the working directory into the container.

View Source

WorkerContractName

Gets or sets the name of the IWorker export contract.

Declaration
[DataMember]
public string WorkerContractName { get; set; }
Property Value
Type Description
string

The name of the IWorker export contract or null as default.

Remarks

Optionally, a discriminator that constrains the selection of the IWorker export for executing this work unit. The standard empty string will just expect a single worker to be located within the working directory. It is valid to leave this field as null. This is only required if you want to support multiple named MEF IWorker's through a single Worker Host.

View Source

WorkingDirectory

Gets the name of the working directory of this work unit.

Declaration
public string WorkingDirectory { get; }
Property Value
Type Description
string

Methods

View Source

AddDependencies(params WorkUnit[])

Adds dependencies to the specified work units.

Declaration
public void AddDependencies(params WorkUnit[] dependencies)
Parameters
Type Name Description
WorkUnit[] dependencies

The dependencies.

View Source

AddDependency(WorkUnit)

Adds a dependency to the specified work unit.

Declaration
public void AddDependency(WorkUnit dependency)
Parameters
Type Name Description
WorkUnit dependency

The dependency.

View Source

GetContent()

Gets the data content.

Declaration
public JToken GetContent()
Returns
Type Description
JToken

The content.

View Source

GetDescendants()

Gets the descendants.

Declaration
public override IEnumerable<WorkItem> GetDescendants()
Returns
Type Description
IEnumerable<WorkItem>

Descendant items.

Overrides
WorkItem.GetDescendants()
View Source

GetExecutableWork(ISerializationContext)

Gets or sets the executable work.

Declaration
public WorkItem GetExecutableWork(ISerializationContext serializationContext = null)
Parameters
Type Name Description
ISerializationContext serializationContext

The serialization context.

Returns
Type Description
WorkItem

The executable work.

View Source

GetInput<T>(ISerializationContext)

Gets the input for the work unit.

Declaration
public T GetInput<T>(ISerializationContext serializationContext = null) where T : class
Parameters
Type Name Description
ISerializationContext serializationContext

Serialization context for the retrieved data.

Returns
Type Description
T

The work unit input.

Type Parameters
Name Description
T

Input type.

Remarks

If the retrieved type requires a serialization context, it can be provided in the optional argument.

Implements

IFlowModelItem
IWorkUnit
IExecutableWorkContainer

Extension Methods

WorkItemExtensions.GetAncestors(WorkItem, WorkItem)
WorkItemExtensions.GetRelativeWeight(WorkItem, WorkItem)
WorkItemExtensions.BuildExecutableWork(WorkItem)
WorkItemExtensions.GetDependencies(WorkUnit)
  • View Source
In this article
Back to top Copyright © DNV AS. All rights reserved.