Skip to content

Instantly share code, notes, and snippets.

@cyounkins cyounkins/activity.py
Last active Jul 20, 2016

Embed
What would you like to do?
from pyswfaws.datastores import *
from pyswfaws.serializers import *
from pyswfaws.decorators import *
from pyswfaws.activityworker import *
from pyswfaws.decisionworker import *
@activity_task(swf_domain='test', swf_task_type='TestActivityA', swf_task_version='1.0',
swf_task_list='task_list',
input_data_serializer=JsonSerializer(), input_data_store=SwfDataStore(),
result_data_serializer=JsonSerializer(), result_data_store=SwfDataStore())
def activity_task_a(a):
return a * a
if __name__ == "__main__":
activity_task_a_runner = DistributedActivityWorker(activity_task_a)
activity_task_a_runner.start()
from pyswfaws.datastores import *
from pyswfaws.serializers import *
from pyswfaws.decorators import *
from pyswfaws.activityworker import *
from pyswfaws.decisionworker import *
@decision_task(swf_domain='test', swf_workflow_type='TestWorkflow', swf_workflow_version='1.0',
swf_task_list='task_list',
input_data_store=SwfDataStore(), input_data_serializer=JsonSerializer(),
result_data_store=SwfDataStore(), result_data_serializer=JsonSerializer())
def decider_a():
a1 = activity_task_a(5)
a2 = activity_task_a(10)
return a1.result + a2.result
if __name__ == "__main__":
decision_task_a_runner = DistributedDecisionWorker(decider_a)
decision_task_a_runner.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.