Class Pipeline
A Pipeline consists of a list of IPipelineWorker that consecutively process the data in each generation update phase.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
[PublicAPI]
public sealed class Pipeline
Constructors
Pipeline(GenerationSettings, GenerationState)
Instantiates a Pipeline.
Declaration
public Pipeline(GenerationSettings generationSettings, GenerationState generationState)
Parameters
| Type | Name | Description |
|---|---|---|
| GenerationSettings | generationSettings | Contains immutable data that cannot be changed during the whole generation loop. |
| GenerationState | generationState | Contains the current state of the generation process and will be updated over time. |
Properties
FrameBudget
Gets or sets the amount of time the pipeline may spend gathering resources/processing each frame before it must yield.
By default the pipeline will yield frequently to avoid causing frame time spikes. This setting may be used to attempt to keep going until the specified budget has been depleted.
Note that there are some operations where the pipeline may yield before the budget has been depleted, for example for download operations during resource gathering.
Note that the pipeline will always exceed this limit slightly, since it is unknown how
long any particular task will take before executing it. As such, the actual frame time
used by the pipeline will be FrameBudget + TimeTakenBySlowestWorker.
Declaration
public TimeSpan FrameBudget { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
GenerationSettings
Gets the immutable state that cannot be changed during the generation loop.
Declaration
public GenerationSettings GenerationSettings { get; }
Property Value
| Type | Description |
|---|---|
| GenerationSettings |
GenerationState
Gets the current state of the generation process that will be updated over time.
Declaration
public GenerationState GenerationState { get; }
Property Value
| Type | Description |
|---|---|
| GenerationState |
GroupCounts
Gets a mapping of group name to number of workers for that group, based on the WorkerGroupAttribute on the workers in this pipeline.
Declaration
public Dictionary<string, int> GroupCounts { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, int> |
Methods
AddSubgraph(IPipelineWorker)
Adds a pipeline worker and, recursively, its inputs to the list in a sorted manner.
Declaration
public void AddSubgraph(IPipelineWorker rootWorker)
Parameters
| Type | Name | Description |
|---|---|---|
| IPipelineWorker | rootWorker | The IPipelineWorker to start adding at to add. |
AddWorkers(IEnumerable<IPipelineWorker>)
Adds a list of pipeline workers and, recursively, their inputs to the list in a sorted manner.
Declaration
public void AddWorkers(IEnumerable<IPipelineWorker> workers)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IPipelineWorker> | workers | The IPipelineWorker to add. |
CleanUpAll()
Cleans up the all Workers.
Declaration
[Obsolete("Use Dispose() instead.")]
public void CleanUpAll()
Clear(IPipelineWorker)
Removes all worker from the list.
Declaration
public void Clear(IPipelineWorker pipelineWorker)
Parameters
| Type | Name | Description |
|---|---|---|
| IPipelineWorker | pipelineWorker | The IPipelineWorker to be cleared. |
Contains(IPipelineWorker)
Tests whether the specified worker is part of this pipeline.
Declaration
public bool Contains(IPipelineWorker worker)
Parameters
| Type | Name | Description |
|---|---|---|
| IPipelineWorker | worker | The IPipelineWorker to test for. |
Returns
| Type | Description |
|---|---|
| bool |
|
Dispose()
Declaration
public void Dispose()
GatherAllResourcesAsync(GenerationContext, IProgress<float>, CancellationToken)
Gathers the resources of the all Workers.
Declaration
public UniTask GatherAllResourcesAsync(GenerationContext context, IProgress<float> onProgressUpdate = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| GenerationContext | context | Contains the immutable meta-information of a single update iteration. |
| IProgress<float> | onProgressUpdate | The feedback function passing the (down)loading progress [0, 1]. |
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Cysharp.Threading.Tasks.UniTask |
GetAllWorkersOfType<T>()
Returns all workers of a specific type in their occuring order within the pipeline.
Declaration
public IEnumerable<T> GetAllWorkersOfType<T>()
Returns
| Type | Description |
|---|---|
| IEnumerable<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
GetRequiredContextTypes()
Gets the set of IGenerationContext types used by the workers in this pipeline.
This can be used to determine which types of context need to be initialized for this pipeline, to avoid the extra work initializing unused contexts would involve.
Declaration
public ISet<Type> GetRequiredContextTypes()
Returns
| Type | Description |
|---|---|
| ISet<Type> | The set of context types required by this pipeline. |
InitAll()
Initializes the all attached IPipelineWorkers.
Declaration
public void InitAll()
InitAllResources()
Initializes the resources of all attached IPipelineWorkers.
Declaration
public void InitAllResources()
ProcessAllAsync(GenerationContext, IProgress<float>, CancellationToken)
Processes the all Workers.
Declaration
public UniTask ProcessAllAsync(GenerationContext context, IProgress<float> onProgressUpdate = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| GenerationContext | context | Contains the immutable meta-information of a single update iteration. |
| IProgress<float> | onProgressUpdate | Called with relative progress in [0, 1]. May be called from another thread. |
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Cysharp.Threading.Tasks.UniTask |
Remove(IPipelineWorker)
Remove a IPipelineWorker from the list.
Declaration
public void Remove(IPipelineWorker worker)
Parameters
| Type | Name | Description |
|---|---|---|
| IPipelineWorker | worker | The IPipelineWorker to be removed. |
SetWorkersAsProcessing()
Flags all workers as being processed.
Used in editor to flag workers as processing while still performing pre-processing to visually indicate the graph is being processed.
Declaration
public void SetWorkersAsProcessing()