from flowy.proxy import SWFActivityProxy as ActivityProxy from flowy.scanner import swf_activity as activity from flowy.scanner import swf_workflow as workflow from flowy.task import SWFActivity as Activity from flowy.task import SWFWorkflow as Workflow from flowy.tests.integration.dependency import Double # make Double available for the scanner Double = activity(1)(Double) @activity(1) class Sum(Activity): def run(self, *n): return sum(n) @workflow(1) class MapReduce(Workflow): """ A toy map reduce example. """ double = ActivityProxy('Double', 1, task_list='example_list2', heartbeat=10, schedule_to_close=20, schedule_to_start=10, start_to_close=15) sum = ActivityProxy('Sum', 1, task_list='example_list2',
from flowy.proxy import SWFActivityProxy as ActivityProxy from flowy.scanner import swf_activity as activity from flowy.scanner import swf_workflow as workflow from flowy.task import SWFActivity as Activity from flowy.task import SWFWorkflow as Workflow from flowy.tests.integration.dependency import Double # make Double available for the scanner Double = activity(1)(Double) @activity(1) class Sum(Activity): def run(self, *n): return sum(n) @workflow(1) class MapReduce(Workflow): """ A toy map reduce example. """ double = ActivityProxy('Double', 1, task_list='example_list2', heartbeat=10, schedule_to_close=20, schedule_to_start=10, start_to_close=15) sum = ActivityProxy('Sum', 1, task_list='example_list2', heartbeat=10, schedule_to_close=20, schedule_to_start=10, start_to_close=15) def run(self, n=10): doubles = map(self.double, range(n)) return self.sum(*doubles)
from flowy.proxy import SWFActivityProxy as ActivityProxy from flowy.proxy import SWFWorkflowProxy as WorkflowProxy from flowy.scanner import swf_activity as activity from flowy.scanner import swf_workflow as workflow from flowy.task import SWFWorkflow as Workflow from flowy.tests.integration.dependency import Identity # make Identity available for the scanner Identity = activity(1)(Identity) @workflow(1) class IdentityW(Workflow): identity1 = ActivityProxy('Identity', 1, task_list='example_list2', heartbeat=100, schedule_to_close=200, schedule_to_start=300, start_to_close=400) identity2 = ActivityProxy('Identity', 1, task_list='example_list1', heartbeat=10, schedule_to_close=20, schedule_to_start=10, start_to_close=15) def run(self): with self.identity1.options(): i1 = self.identity1(100) with self.identity2.options(task_list='example_list2', heartbeat=100, schedule_to_close=200, start_to_close=400, schedule_to_start=300): i2 = self.identity2(100) return i1.result() + i2.result() @workflow(1)
import os import time from flowy.proxy import SWFActivityProxy as ActivityProxy from flowy.scanner import swf_activity as activity from flowy.scanner import swf_workflow as workflow from flowy.task import SWFActivity as Activity from flowy.task import SWFWorkflow as Workflow from flowy.tests.integration.dependency import Identity # make Identity available for the scanner Identity = activity(1)(Identity) @workflow(1) class WorkflowFailure(Workflow): error = ActivityProxy('Error', 1, task_list='example_list2', heartbeat=5, schedule_to_close=20, schedule_to_start=10, start_to_close=15) def run(self): return self.error() @workflow(1) class ErrorChaining(Workflow): identity = ActivityProxy('Identity',
from flowy.scanner import activity, workflow from mock import sentinel as s a1 = activity(s.task_id, s.task_list)(s.task_factory1) a2 = activity( s.task_id, s.task_list, heartbeat='6', schedule_to_close=42.0, schedule_to_start=12, start_to_close=30)(s.task_factory2) w1 = workflow(s.task_id, s.task_list)(s.task_factory3) w2 = workflow( s.task_id, s.task_list, workflow_duration='120', decision_duration=5.0)(s.task_factory4)