StepFunctions Activity Worker
A worker that listens to a StepFunctions activity and executes a provided function using the inputs from the activity task.
The StepFunctions Activity Worker encapsulates all the parts of communicating with the StepFunctions API so you don't have to worry about task heartbeats or maintaining task tokens and success/failure scenarios; all you have to worry about is executing the task.
Installation
Install from PyPI:
pip install stepfunctions_activity_worker
Usage
from stepfunctions_activity_worker import ActivityWorker
def my_task(**task_input):
"""Perform the task based on this task's input."""
# Perform your task here!
return {"result": "done!"}
if __name__ == "__main__":
activity_arn = "PLACE YOUR ACTIVITY ARN HERE"
worker = ActivityWorker(activity_arn, my_task)
worker.listen()
Warning
The ActivityWorker class, if not provided with a client argument on instantiation, will create a properly configured client from your default session.
However, if you are providing an already instantiated client to the ActivityWorker class, make sure it is proply configured to make StepFunctions API calls!
The GetActivityTask API call blocks for 60 seconds which matches the botocore.config.Config default read_timeout. This means that if the API response for GetActivityTask is not punctual (which it often isn't) it will cause unnecessary retry-requests & eventually bubble up an HTTP exception.
import boto3
import botocore
from stepfunctions_activity_worker import ActivityWorker
def my_task(**task_input):
"""Perform the task based on this task's input."""
# Perform your task here!
return {"result": "done!"}
config = botocore.config.Config(
read_timeout=70,
# Insert other custom configuration here
)
stepfunctions = boto3.client('stepfunctions', config=config)
activity_worker = ActivityWorker(activity_arn, my_task, client=stepfunctions)
Metadata
Release files for stepfunctions-activity-worker 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stepfunctions_activity_worker-1.1.3.tar.gz | 3.7 kB | Without provenance | Details for stepfunctions_activity_worker-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stepfunctions_activity_worker-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for stepfunctions_activity_worker-1.1.3-py3-none-any.whl |
Total release size: 9.2 kB
Release files / stepfunctions_activity_worker-1.1.3.tar.gz
| Download URL | stepfunctions_activity_worker-1.1.3.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a6f680b85d8253f4bf6c30824c9deb94374cb789791096cd0e661c090796c82
|
|
BLAKE2b-256 checksum How to use checksums |
7e686776e400938595e091e4e0d4457f021e508c948560e433689ff66d278d82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
|
Release files / stepfunctions_activity_worker-1.1.3-py3-none-any.whl
| Download URL | stepfunctions_activity_worker-1.1.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d5a3a1bf4f56bb40132d2bd2bbf5a60901f5162d1db76a868545914939b5436
|
|
BLAKE2b-256 checksum How to use checksums |
1e2610ae740db371d87008f53584a71b7e50c777772fdf48810acce1baceffc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
|
Security for stepfunctions-activity-worker 1.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.