Class WorkUnit
Models atomic (non-decomposable) work.
Inherited Members
Namespace: DNVGL.One.Compute.Core.FlowModel
Assembly: DNVGL.One.Compute.Core.dll
Syntax
[DataContract]
public class WorkUnit : WorkItem, IFlowModelItem, IWorkUnit, IExecutableWorkContainer
Constructors
View SourceWorkUnit()
Initializes a new instance of the WorkUnit class.
Declaration
public WorkUnit()
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. |
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 SourceAlias
Gets the alias for this work unit.
Declaration
public string Alias { get; }
Property Value
Type | Description |
---|---|
string |
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).
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.
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.
InputFileSpecifications
Gets or sets the input file specifications.
Declaration
[DataMember]
public FileTransferSpecification[] InputFileSpecifications { get; set; }
Property Value
Type | Description |
---|---|
FileTransferSpecification[] | The input file specifications. |
InputFiles
Gets or sets the resources.
Declaration
[DataMember]
public List<string> InputFiles { get; set; }
Property Value
Type | Description |
---|---|
List<string> | The resources. |
OutputFileSpecifications
Gets or sets the output file specifications.
Declaration
[DataMember]
public FileTransferSpecification[] OutputFileSpecifications { get; set; }
Property Value
Type | Description |
---|---|
FileTransferSpecification[] | The output file specifications. |
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.
SchedulerId
Gets or sets the scheduler identifier.
Declaration
public string SchedulerId { get; set; }
Property Value
Type | Description |
---|---|
string | The scheduler identifier. |
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.
StatusUpdateFrequency
Gets or sets the status update frequency in seconds.
Declaration
public int StatusUpdateFrequency { get; set; }
Property Value
Type | Description |
---|---|
int |
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. |
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.
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.
WorkingDirectory
Gets the name of the working directory of this work unit.
Declaration
public string WorkingDirectory { get; }
Property Value
Type | Description |
---|---|
string |
Methods
View SourceAddDependencies(params WorkUnit[])
Adds dependencies to the specified work units.
Declaration
public void AddDependencies(params WorkUnit[] dependencies)
Parameters
Type | Name | Description |
---|---|---|
WorkUnit[] | dependencies | The dependencies. |
AddDependency(WorkUnit)
Adds a dependency to the specified work unit.
Declaration
public void AddDependency(WorkUnit dependency)
Parameters
Type | Name | Description |
---|---|---|
WorkUnit | dependency | The dependency. |
GetContent()
Gets the data content.
Declaration
public JToken GetContent()
Returns
Type | Description |
---|---|
JToken | The content. |
GetDescendants()
Gets the descendants.
Declaration
public override IEnumerable<WorkItem> GetDescendants()
Returns
Type | Description |
---|---|
IEnumerable<WorkItem> | Descendant items. |
Overrides
View SourceGetExecutableWork(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. |
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.