new WorkflowVersion(name, version, domain, options)
Represents a single, named workflow, where all activities and decisions are defined.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
name |
string | The name of the workflow. | |
version |
string | Version(s) this workflow can handle (conforms to v2.0 of http://semver.org) | |
domain |
string | The AWS SWF domain name to execute this workflow in. | |
options |
object |
<optional> |
Additional SWF options used when creating and executing this workflow (taskList, tagList, childPolicy, executionStartToCloseTimeout, taskStartToCloseTimeout) |
- Source:
Extends
Methods
-
accumulator(name, deps, fragment, doneFn, options) → {Fragment}
-
Add a accumulator execution to the workflow The accumulator executes a fragment until the `doneFn` returns a truthy value, taking the results of each iteration and making them available to any dependents
Parameters:
Name Type Argument Description namestring The unique name of the accumulator fragment. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. fragmentFragment The workflow fragment to iterate over. Generated by `usher.fragment()` doneFnfunction Indicates when the accumulator is complete by returning a truthy value. optionsObject <optional>
Custom options for this activity. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
activity(name, deps, options) → {Fragment}
-
Add an activity to the workflow
Parameters:
Name Type Argument Description namestring The unique name of the activity. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. optionsObject <optional>
Custom options for this activity. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
activityDefaults(options) → {Fragment}
-
Set global activity options for the entire workflow
Parameters:
Name Type Description optionsObject Custom options to use for all defined activities. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
child(name, deps, workflowName, workflowVersion, options) → {Fragment}
-
Add an child workflow execution to the workflow
Parameters:
Name Type Argument Description namestring The unique name of the child workflow. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. workflowNamestring The name of the workflow to execute. workflowVersionstring The version of the workflow to execute. optionsObject <optional>
Custom options for this activity. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
decision(name, deps, decisionFn) → {Fragment}
-
Add a decision to the workflow
Parameters:
Name Type Argument Description namestring The unique name of the decision. depsArray <optional>
The names of the dependencies that must be met before this decision can execute. decisionFnFragment~decisionLogic The logic for this decision. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
execute() → {WorkflowVersion}
-
Execute a new run of this workflow
- Source:
Returns:
This workflow so you can chain commands.- Type
- WorkflowVersion
-
loop(name, deps, fragment, loopFn, options) → {Fragment}
-
Add a looping workflow execution to the workflow The loop executes in batches to help alleviate rate limit exceptions. The number of items to proccess per batch and the delay between batches are both configurable.
Parameters:
Name Type Argument Description namestring The unique name of the loop fragment. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. fragmentFragment The workflow fragment to loop over. Generated by `usher.fragment()` loopFnfunction A function given the taks's input that returns an array. For every item in the Array an execution of the `fragment` workflow will execute. optionsObject <optional>
Custom options for this activity. [itemsPerBatch, batchDelay] - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
result(name, deps, transformFn) → {Fragment}
-
Add a result transformation to the workflow. This sets the fragments results based on the `transformFn`
Parameters:
Name Type Argument Description namestring The unique name of the result task. depsArray <optional>
The names of the dependencies that must be met before this decision can execute. transformFnFragment~transformationLogic <optional>
The funtion that will perform the transformation. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
sequencedTasks() → {Array}
-
Get the defined tasks for the fragment in execution order
- Inherited From:
- Source:
Returns:
An array of defined tasks- Type
- Array
-
tasks() → {Array}
-
Get the defined tasks for the fragment
- Inherited From:
- Source:
Returns:
An array of defined tasks- Type
- Array
-
terminate(name, deps) → {Fragment}
-
Add a termination point to the workflow
Parameters:
Name Type Argument Description namestring The unique name that represents this termination point. depsArray <optional>
The names of the dependencies that must be met before the workflow can terminate. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
transform(name, deps, transformFn) → {Fragment}
-
Add a transformation to the workflow. Transformations are good for manipulating the results of prior activities into new representations for future dependents.
Parameters:
Name Type Argument Description namestring The unique name of the transformation. depsArray <optional>
The names of the dependencies that must be met before this decision can execute. transformFnFragment~transformationLogic <optional>
The funtion that will perform the transformation. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
validate() → {WorkflowVersion}
-
Validate this workflow
- Source:
Returns:
This workflow version so you can chain commands.- Type
- WorkflowVersion
-
variable(name, deps, valueFn) → {Fragment}
-
Set an variable accessable to all future scheduled activities
Parameters:
Name Type Argument Description namestring The unique name of the variable. depsArray <optional>
The names of the dependencies that must be met before this variable can be set. valueFnFragment~variableValueFunction <optional>
The funtion that will calculate the variable name. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
whileLoop(name, deps, fragment, doneFn, options) → {Fragment}
-
Add a while loop workflow execution to the workflow The loop executes until the `doneFn` returns a truthy value
Parameters:
Name Type Argument Description namestring The unique name of the while loop fragment. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. fragmentFragment The workflow fragment to loop over. Generated by `usher.fragment()` doneFnfunction Indicates when the loop is complete by returning a truthy value. optionsObject <optional>
Custom options for this activity. - Inherited From:
- Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment