Home > @rushstack/operation-graph > Operation
Operation class
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
The Operation class is a node in the dependency graph of work that needs to be scheduled by the OperationExecutionManager. Each Operation has a runner member of type IOperationRunner, whose implementation manages the actual process of running a single operation.
The graph of Operation instances will be cloned into a separate execution graph after processing.
Signature:
export declare class Operation<TMetadata extends {} = {}, TGroupMetadata extends {} = {}> implements IOperationStates
Implements: IOperationStates
Constructors
Constructor | Modifiers | Description |
|---|---|---|
(BETA) Constructs a new instance of the |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
| Set<Operation<TMetadata, TGroupMetadata>> | (BETA) A set of all operations that wait for this operation. | |
number | undefined | (BETA) This number represents how far away this Operation is from the furthest "root" operation (i.e. an operation with no consumers). This helps us to calculate the critical path (i.e. the longest chain of projects which must be executed in order, thereby limiting execution speed of the entire operation tree. This number is calculated via a memoized depth-first search, and when choosing the next operation to execute, the operation with the highest criticalPathLength is chosen. Example: (0) A \ (1) B C (0) (applications) \ /|\ \ / | \ (2) D | X (1) (utilities) | / \ |/ \ (2) Y Z (2) (other utilities) All roots (A & C) have a criticalPathLength of 0. B has a score of 1, since A depends on it. D has a score of 2, since we look at the longest chain (e.g D->B->A is longer than D->C) X has a score of 1, since the only package which depends on it is A Z has a score of 2, since only X depends on it, and X has a score of 1 Y has a score of 2, since the chain Y->X->C is longer than Y->C The algorithm is implemented in AsyncOperationQueue.ts as calculateCriticalPathLength() | ||
| Set<Operation<TMetadata, TGroupMetadata>> | (BETA) A set of all dependencies which must be executed before this operation is complete. | |
| OperationGroupRecord<TGroupMetadata> | undefined | (BETA) If specified, the name of a grouping to which this Operation belongs, for logging start and end times. | |
IOperationState | undefined | (BETA) The state of this operation the previous time a manager was invoked. | ||
| TMetadata | (BETA) | |
| string | (BETA) The name of this operation, for logging. | |
IOperationRunner | undefined | (BETA) When the scheduler is ready to process this | ||
IOperationState | undefined | (BETA) The current state of this operation | ||
number | (BETA) The weight for this operation. This scalar is the contribution of this operation to the |
Methods
Method | Modifiers | Description |
|---|---|---|
(BETA) | ||
(BETA) | ||
(BETA) |