Lightweight library for AWS SWF.
Project description
Lightweight library for AWS SWF.
Garcon deals with easy going clients and kitchens. It takes orders from clients (deciders), and send them to the kitchen (activities). Difficult clients and kitchens can be handled directly by the restaurant manager.
Requirements
Python 3.8, 3.9, 3.10, 3.11, 3.12 (tested)
Boto3 (tested)
Goal
The goal of this library is to allow the creation of Amazon Simple Workflow without the need to worry about the orchestration of the different activities and building out the different workers. This framework aims to help simple workflows. If you have a more complex case, you might want to use directly boto3.
Code sample
The code sample shows a workflow where a user enters a coffee shop, orders a coffee and a chocolate chip cookie. All ordered items are prepared and completed, the user pays the order, receives the ordered items, then leave the shop.
The code below represents the workflow decider. For the full code sample, see the example.
enter = schedule('enter', self.create_enter_coffee_activity)
enter.wait()
total = 0
for item in ['coffee', 'chocolate_chip_cookie']:
activity_name = 'order_{item}'.format(item=item)
activity = schedule(activity_name,
self.create_order_activity,
input={'item': item})
total += activity.result.get('price')
pay_activity = schedule(
'pay', self.create_payment_activity,
input={'total': total})
get_order = schedule('get_order', self.create_get_order_activity)
# Waiting for paying and getting the order to complete before
# we let the user leave the coffee shop.
pay_activity.wait(), get_order.wait()
schedule('leave_coffee_shop', self.create_leave_coffee_shop)
Application architecture
. ├── cli.py # Instantiate the workers ├── flows # All your application flows. │ ├── __init__.py │ └── example.py # Should contain a structure similar to the code sample. ├── tasks # All your tasks │ ├── __init__.py │ └── s3.py # Task that focuses on s3 files. └── task_example.py # Your different tasks.
Trusted by
Contributors
Michael Ortali (Author)
Adam Griffiths
Raphael Antonmattei
John Penner
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
Built Distribution
File details
Details for the file garcon-1.1.1.tar.gz
.
File metadata
- Download URL: garcon-1.1.1.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 799ffc676b69209cb8a943790c8d3f23cbcec0313e7ae9d86dcb425fe1f2e46a |
|
MD5 | 5b38b97e3066c3bfe9d4f7a2d78d2ffa |
|
BLAKE2b-256 | 0dee1504e60d3e78722e062a0c2979753aae2942c20f39e2eb457402b84e14ac |
File details
Details for the file Garcon-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: Garcon-1.1.1-py3-none-any.whl
- Upload date:
- Size: 39.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 594ed33514b56653e663116e286209f12043d2a24de8f4d4c5042b80188a7d18 |
|
MD5 | 44ffbe2bf26a4a8871a776d628457172 |
|
BLAKE2b-256 | ce665884abc8ebc3cc732c321f60d238fa398cbf29f0012d007d997988148731 |