aws swf的轻量级库。
Garcon的Python项目详细描述
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.
要求
- python 2.7、3.4(已测试)
- BOTO 2.34.0(测试)
目标
这个库的目标是允许创建amazon simple 无需担心 不同的活动,造就不同的劳动者。这个 框架旨在帮助简化工作流。如果你有更复杂的 case,你可能想直接用boto。
代码示例
代码示例显示了一个包含4个活动的工作流。它开始于 活动1,完成后安排活动2和 并行运行活动3。工作流在 完成活动4,需要活动2和活动3 完成。
from__future__importprint_functionfromgarconimportactivityfromgarconimportrunnerdomain='dev'name='workflow_sample'create=activity.create(domain,name)test_activity_1=create(name='activity_1',run=runner.Sync(lambdaactivity,context:print('activity_1')))test_activity_2=create(name='activity_2',requires=[test_activity_1],run=runner.Async(lambdaactivity,context:print('activity_2_task_1'),lambdaactivity,context:print('activity_2_task_2')))test_activity_3=create(name='activity_3',requires=[test_activity_1],run=runner.Sync(lambdaactivity,context:print('activity_3')))test_activity_4=create(name='activity_4',requires=[test_activity_3,test_activity_2],run=runner.Sync(lambdaactivity,context:print('activity_4')))
应用程序架构
. ├── 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.
贡献者
- 迈克尔·奥塔利
- 亚当·格里菲斯
- 拉斐尔·安东马特
- 约翰·彭纳