Enhanced, asyncio-compatible client for AWS Step Functions.
Project description
sfn_workflow_client
Enhanced, asyncio-compatible client for AWS Step Functions.
Features:
- Trigger new executions
- Query for state machine execution status
- Wait for an execution to complete
- Fetch execution history
Table of Contents:
Installation
sfn_workflow_client requires Python 3.6 or above.
pip install sfn_workflow_client
Guide
from sfn_workflow_client.enums import ExecutionStatus
from sfn_workflow_client.workflow import Workflow
# Initialize a workflow client
workflow = Workflow("my-state-machine")
# Fetch all executions
collection = await workflow.executions.fetch()
# Fetch currently running executions
collection = await workflow.executions.fetch(status=ExecutionStatus.running)
# Start a new execution
execution = await workflow.executions.create().start()
# Start a new execution and wait until it completes (useful for tests)
execution = await workflow.executions.start_sync()
# Find an execution by trace ID (for tests)
execution = await workflow.executions.fetch().find_by_trace_id("abc")
# Fetch the event history of an execution
events = await execution.events.fetch()
Development
To develop sfn_workflow_client, install dependencies and enable the pre-commit hook:
pip install pre-commit tox
pre-commit install
To run functional tests, you need to create an AWS IAM role with permissions to:
- Create/update/delete state machines
- Start/stop executions
Set the following environment variables:
AWS_ACCOUNT_ID
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
AWS_IAM_ROLE_ARN
To run tests:
tox
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sfn_workflow_client-0.3.0.tar.gz
(11.2 kB
view hashes)
Built Distribution
Close
Hashes for sfn_workflow_client-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee7c865f56181880b6e80bba3dc8cc384a7837e467f50a7db1dabc5d87a92fc2 |
|
MD5 | a92e924885fb9dad2d667e1d587987ea |
|
BLAKE2b-256 | 7cddfda8c8e42a36e31054bfaa07c0696e3e2b2d1716c907510ef14c095759ec |
Close
Hashes for sfn_workflow_client-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a2ae8d32354863aaf7d2eea87f720d583afcbb79f29d6627d05ca7f3b56d0aa |
|
MD5 | 67b8d23cc973d334ef3eb005eafb61b7 |
|
BLAKE2b-256 | 4b48d2c67069cfdada76e2943c33ab739a947ee1975f2f05f49ed11e3ed82afc |