Skip to main content

Caravan

Light python framework for AWS SWF

About this Project

Caravan is being used at Ludia for projects like marketing campaign system and on-demand distributed processing systems (thanks to hundreds of Lambda functions).

Feedbacks, ideas and contributions are highly welcomed. (Just open a Github issue).

Focus of this project

Similar projects exists (like Simpleflow which seems mature). Here is where Caravan differs from existing projects:

  • Support of AWS Lambda tasks

  • Boto3

  • KISS

  • Bring your own workflow framework (standard implementations as contribs)

  • No coupling between Decider code and Activity code

  • Paster compatible config file

Features

  • Decider worker

  • Activity task worker TODO

  • Commands to start/signal/terminate an arbitrary workflow execution

  • Command to list open workflow execution

  • Command to register a domain / list domains

Configuration

Caravan uses Boto3 to connect to AWS. See Boto 3 configuration guide for the complete documentation.

Environment Variables

AWS_ACCESS_KEY_ID

The access key for your AWS account.

AWS_SECRET_ACCESS_KEY

The secret key for your AWS account.

AWS_DEFAULT_REGION

The default region to use, e.g. us-east-1.

AWS_PROFILE

The default credential and configuration profile to use, if any.

Configuration Files

The credentials file is located at ~/.aws/credentials:

[default]
# The access key for your AWS account
aws_access_key_id=<YOUR ACCESS KEY ID>

# The secret key for your AWS account
aws_secret_access_key=<YOUR SECRET KEY>

The settings file is located at ~/.aws/config:

[default]
# The default region when making requests
region=<REGION NAME>

It also supports profiles:

[profile dev-profile]
# The default region when using the dev-profile account
region=<REGION NAME>

Demo

Setup a SWF domain to run this example:

$ caravan-domain-register -n CaravanDemo --retention-days 1

Write a workflow type (see full demo)

from caravan import Workflow


class Demo(Workflow):

    """Noop workflow using the bare caravan API."""

    name = 'Demo'
    version = '0.1'
    default_execution_start_to_close_timeout = '600'
    default_task_start_to_close_timeout = '10'

    def run(self):
        self.task.print_events()
        self.task.add_decision('CompleteWorkflowExecution')

Run the decider with the Demo workflow:

$ caravan-decider -d CaravanDemo -m caravan.examples.demo -t default --verbose

Start an execution of the Demo workflow:

$ caravan-start -d CaravanDemo -n Demo -v 0.1 -i 1

(The Demo workflow will wait for 5 minutes)

List the executions:

$ caravan-list -d CaravanDemo
$ caravan-list -d CaravanDemo --oldest 2015-01-01

Send a signal to an execution:

$ caravan-signal -d CaravanDemo -i 1 -s PRINT --input 'Hello World!'
$ caravan-signal -d CaravanDemo -i 1 -s PRINT --input 'Lorem ipsum'
$ caravan-signal -d CaravanDemo -i 1 -s STOP

Terminate an execution:

$ caravan-terminate -d CaravanDemo -i 1

Similar projects

Python:

Ruby:

References

Development

Possibly use virtualenvwrapper to manage your virtualenvs.

$ mkvirtualenv caravan

or

$ virtualenv caravan

Clone and install development dependencies:

(caravan)$ git clone git@github.com:pior/caravan.git
(caravan)$ cd caravan
(caravan)$ pip install -e .[dev]

Run tests:

(caravan)$ nosetests

Release

The release process use zest.releaser:

$ fullrelease

License

MIT licensed. See the bundled LICENSE file for more details

Metadata

Release files for caravan 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for caravan 0.2.2
File Size Uploaded Provenance
caravan-0.2.2.tar.gz 19.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for caravan 0.2.2
File Interpreter ABI Platform
caravan-0.2.2-py2-none-any.whl Python 2 none any Details

Total release size: 51.8 kB

Release files / caravan-0.2.2.tar.gz

Download URL caravan-0.2.2.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a2fe28892ba5657328527c2952f64deb639147bf117e756077f99c7d69a9a12b
BLAKE2b-256 checksum
How to use checksums
6956cc47a1089782f2241379710f39f7ba88577fc701a623a3cae82f77e8d792
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / caravan-0.2.2-py2-none-any.whl

Download URL caravan-0.2.2-py2-none-any.whl
Size 32.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
8748a069a437751b2c7ddd0ce80db959107c47eb714257474fb51c22aa14b9e4
BLAKE2b-256 checksum
How to use checksums
b081a2f1dd81ec9273a93aadd2647b2e95f44b01234cd789f745a9dc286b3cf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for caravan 0.2.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page