> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# narrativescience/workflow-manager

Manage workflow concurrency and job state using an external store


## Commands

### cancel-job

Cancel the current job based on an environment variable

| Parameter | Type | Default | Description |
|---|---|---|---|
| `method` | enum | cancel | Method of cancellation; Either cancel the job or just halt the step so the job
still succeeds
 |
| `sleep_timeout` | integer | 60 | The amount of time we want to wait for circleci to cancel the job |

### exit-queue

Exit the queue when a workflow is finished

| Parameter | Type | Default | Description |
|---|---|---|---|
| `exit_condition` | enum | always | Only release the lock under a certain condition |
| `lock_key_env_var_name` | env_var_name | WORKFLOW_LOCK_KEY | Environment variable containing the key of the workflow lock to release. This
should generally be set in a Context.
 |

### initialize-state-store

Download state data to a local file and inject values into the environment

| Parameter | Type | Default | Description |
|---|---|---|---|
| `path` | string | /tmp/state.json | Path to store the state file |

### send-slack-on-workflow-recovery

Send a Slack message to a channel if the workflow has recovered

| Parameter | Type | Default | Description |
|---|---|---|---|
| `channel` | string |  | The channel to send the slack notification to. Defaults to empty string which is the web-hooks default channel.
 |
| `message` | string |  | The message to send with the slack notification |

### set-state

Set state data to the remote store

| Parameter | Type | Default | Description |
|---|---|---|---|
| `key` | string |  | Key to set in the state |
| `value_type` | enum | S | DynamoDB data type. See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValue.html.
Only a few are currently supported in this command.
 |
| `value_var_name` | env_var_name |  | Environment variable to source the value |

### wait-in-queue

Wait in a workflow queue until the job is at the front

| Parameter | Type | Default | Description |
|---|---|---|---|
| `check_previous_commit` | boolean | false | Whether to check if the previous commit has been added to the queue before
continuing with the workflow. This helps deal with the race condition of two
commits getting merged seconds apart.
 |
| `do_not_cancel_workflow_if_tag_in_commit` | string |  | Do not allow this workflow to self-cancel, even if it could have been ignored, if
the provided tag is in the commit message (case-insensitive)
 |
| `force` | boolean | false | Whether to continue on with the workflow regardless of if another workflow is
running
 |
| `lock_key_env_var_name` | env_var_name | WORKFLOW_LOCK_KEY | Environment variable containing the key of the workflow lock
to acquire. This should generally be set in a Context.
 |
| `poll_interval` | integer | 10 | Polling interval between attempts to continue the workflow (in seconds) |
| `ttl` | string | 7 days | TTL of the workflow item in the store specified as a date string.
See http://man7.org/linux/man-pages/man1/date.1.html#DATE_STRING for the format
and https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html
for how DynamoDB manages TTL.
 |
| `wait_for` | integer | 240 | How long to wait before giving up (in minutes) |

## Jobs

### exit-queue

Exit the queue when a workflow is finished

| Parameter | Type | Default | Description |
|---|---|---|---|
| `channel` | string |  | The channel to send the slack notification to. Defaults to empty string which is the web-hooks default channel.
 |
| `message` | string | :tada: $WORKFLOW_LOCK_KEY has recovered! | The message to send with the slack notification |
| `send_slack_on_recovery` | boolean | false | If true, the default channel will be notified on workflow recovery |

### wait-in-queue

Wait in a workflow queue until the job is at the front

| Parameter | Type | Default | Description |
|---|---|---|---|
| `check_previous_commit` | boolean | false | Whether to check if the previous commit has been added to the queue before
continuing with the workflow. This helps deal with the race condition of two
commits getting merged seconds apart.
 |
| `do_not_cancel_workflow_if_tag_in_commit` | string |  | Do not allow this workflow to self-cancel, even if it could have been ignored, if
the provided tag is in the commit message (case-insensitive)
 |
| `force` | boolean | false | Whether to continue on with the workflow regardless of if another workflow is
running
 |
| `lock_key_env_var_name` | env_var_name | WORKFLOW_LOCK_KEY | Environment variable containing the key of the workflow lock
to acquire. This should generally be set in a Context.
 |
| `poll_interval` | integer | 10 | Polling interval between attempts to continue the workflow (in seconds) |
| `ttl` | string | 7 days | TTL of the workflow item in the store specified as a date string.
See http://man7.org/linux/man-pages/man1/date.1.html#DATE_STRING for the format
and https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html
for how DynamoDB manages TTL.
 |
| `wait_for` | integer | 240 | How long to wait before giving up (in minutes) |