Class WorkUnit
Models atomic (not decomposable) work
Inherited Members
Namespace: DNVGL.One.Compute.Core.FlowModel
Assembly: DNVGL.One.Compute.Core.dll
Syntax
public class WorkUnit : WorkItem, IFlowModelItem, IWorkUnit
Constructors
View SourceWorkUnit()
Initializes a new instance of the WorkUnit class.
Declaration
public WorkUnit()
WorkUnit(Object, ISerializationContext)
Initializes a new instance of the WorkUnit class.
Declaration
public WorkUnit(object input, ISerializationContext serializationContext = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | input | The input to the work unit. |
ISerializationContext | serializationContext | Serialization context for the input. |
Properties
View SourceCommand
Gets or sets the command.
Declaration
public string Command { get; set; }
Property Value
Type | Description |
---|---|
System.String | The command. |
Remarks
This may be used by the application to control the work scheduling code.
Data
Gets or sets the container of input data.
Declaration
public DataContainer Data { get; set; }
Property Value
Type | Description |
---|---|
DataContainer | The data container of the input data. |
Dependencies
Gets or sets the dependencies.
Declaration
public List<string> Dependencies { get; set; }
Property Value
Type | Description |
---|---|
List<System.String> | The dependencies. |
Remarks
List of ids of WorkUnits that this work unit depends on.
InputFiles
Gets or sets the resources.
Declaration
public List<string> InputFiles { get; set; }
Property Value
Type | Description |
---|---|
List<System.String> | The resources. |
InputFileSpecifications
Gets or sets the input file specifications.
Declaration
public FileTransferSpecification[] InputFileSpecifications { get; set; }
Property Value
Type | Description |
---|---|
FileTransferSpecification[] | The input file specifications. |
IsReductionTask
Gets or sets a value indicating whether this work unit is a reduction task for the parent.
Declaration
public bool IsReductionTask { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
OutputFiles
Gets or sets the output files.
Declaration
public List<DataTransferSpecification> OutputFiles { get; set; }
Property Value
Type | Description |
---|---|
List<DataTransferSpecification> | The output files. |
OutputFileSpecifications
Gets or sets the output file specifications.
Declaration
public FileTransferSpecification[] OutputFileSpecifications { get; set; }
Property Value
Type | Description |
---|---|
FileTransferSpecification[] | The output file specifications. |
Request
Gets or sets the application request.
Declaration
public string Request { get; set; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.String | The scheduler identifier. |
ServiceName
Gets or sets the name of the service.
Declaration
public string ServiceName { get; set; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.Int32 |
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
public string WorkerAssemblyFileName { get; set; }
Property Value
Type | Description |
---|---|
System.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
public string WorkerContractName { get; set; }
Property Value
Type | Description |
---|---|
System.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.
Methods
View SourceAddDependencies(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 SourceGetInput<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.