Generates a semaphore for a StepFunction job (or chained set of jobs) to limit parallelism across executions.
import { Semaphore } from '@dontirun/state-machine-semaphore'
new Semaphore(scope: Construct, id: string, props: SemaphoreProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
SemaphoreProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: SemaphoreProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
next |
Continue normal execution with the given state. |
prefixStates |
Prefix the IDs of all states in this state machine fragment. |
toSingleState |
Wrap all states in this state machine fragment up into a single state. |
public toString(): string
Returns a string representation of this construct.
public next(next: IChainable): Chain
Continue normal execution with the given state.
- Type: aws-cdk-lib.aws_stepfunctions.IChainable
public prefixStates(prefix?: string): StateMachineFragment
Prefix the IDs of all states in this state machine fragment.
Use this to avoid multiple copies of the state machine all having the same state IDs.
- Type: string
The prefix to add.
Will use construct ID by default.
public toSingleState(options?: SingleStateOptions): Parallel
Wrap all states in this state machine fragment up into a single state.
This can be used to add retry or error handling onto this state machine fragment.
Be aware that this changes the result of the inner state machine to be an array with the result of the state machine in it. Adjust your paths accordingly. For example, change 'outputPath' to '$[0]'.
- Type: aws-cdk-lib.aws_stepfunctions.SingleStateOptions
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
import { Semaphore } from '@dontirun/state-machine-semaphore'
Semaphore.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
endStates |
aws-cdk-lib.aws_stepfunctions.INextable[] |
The states to chain onto if this fragment is used. |
id |
string |
Descriptive identifier for this chainable. |
startState |
aws-cdk-lib.aws_stepfunctions.State |
The start state of this state machine fragment. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly endStates: INextable[];
- Type: aws-cdk-lib.aws_stepfunctions.INextable[]
The states to chain onto if this fragment is used.
public readonly id: string;
- Type: string
Descriptive identifier for this chainable.
public readonly startState: State;
- Type: aws-cdk-lib.aws_stepfunctions.State
The start state of this state machine fragment.
Interface for creating a Semaphore.
import { SemaphoreProps } from '@dontirun/state-machine-semaphore'
const semaphoreProps: SemaphoreProps = { ... }
Name | Type | Description |
---|---|---|
job |
IChainNextable |
The job (or chained jobs) to be semaphored. |
limit |
number |
The maximum number of concurrent executions for the given lock. |
lockName |
string |
The name of the semaphore. |
nextState |
aws-cdk-lib.aws_stepfunctions.State |
The State to go to after the semaphored job completes. |
comments |
boolean |
Add detailed comments to lock related states. |
reuseLock |
boolean |
Explicility allow the reuse of a named lock from a previously generated job. |
tableReadWriteCapacity |
TableReadWriteCapacity |
Optionally set the DynamoDB table to have a specific read/write capacity with PROVISIONED billing. |
public readonly job: IChainNextable;
- Type: IChainNextable
The job (or chained jobs) to be semaphored.
public readonly limit: number;
- Type: number
The maximum number of concurrent executions for the given lock.
public readonly lockName: string;
- Type: string
The name of the semaphore.
public readonly nextState: State;
- Type: aws-cdk-lib.aws_stepfunctions.State
The State to go to after the semaphored job completes.
public readonly comments: boolean;
- Type: boolean
Add detailed comments to lock related states.
Significantly increases CloudFormation template size. Default: false.
public readonly reuseLock: boolean;
- Type: boolean
Explicility allow the reuse of a named lock from a previously generated job.
Throws an error if a different limit
is specified. Default: false.
public readonly tableReadWriteCapacity: TableReadWriteCapacity;
- Type: TableReadWriteCapacity
- Default: PAY_PER_REQUEST
Optionally set the DynamoDB table to have a specific read/write capacity with PROVISIONED billing.
Note: This property can only be set on the first instantiation of a Semaphore
per stack
Read and write capacity for a PROVISIONED billing DynamoDB table.
import { TableReadWriteCapacity } from '@dontirun/state-machine-semaphore'
const tableReadWriteCapacity: TableReadWriteCapacity = { ... }
Name | Type | Description |
---|---|---|
readCapacity |
number |
No description. |
writeCapacity |
number |
No description. |
public readonly readCapacity: number;
- Type: number
public readonly writeCapacity: number;
- Type: number
-
Extends: aws-cdk-lib.aws_stepfunctions.IChainable, aws-cdk-lib.aws_stepfunctions.INextable
-
Implemented By: IChainNextable
Name | Type | Description |
---|---|---|
endStates |
aws-cdk-lib.aws_stepfunctions.INextable[] |
The chainable end state(s) of this chainable. |
id |
string |
Descriptive identifier for this chainable. |
startState |
aws-cdk-lib.aws_stepfunctions.State |
The start state of this chainable. |
public readonly endStates: INextable[];
- Type: aws-cdk-lib.aws_stepfunctions.INextable[]
The chainable end state(s) of this chainable.
public readonly id: string;
- Type: string
Descriptive identifier for this chainable.
public readonly startState: State;
- Type: aws-cdk-lib.aws_stepfunctions.State
The start state of this chainable.