-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some flows are more complex than others. For instance: some activities can be scheduled based on a condition in the context. Being able to (easily) write the decider has a lot of advantages. For this: in your flow, you need to define a decider method that takes a `schedule` param. To call an activity, all you have to do is to call `schedule`, provide an immutable id, the activity and a list (if necessary) of requirements. Example: ```python def decider(schedule): activity_1 = schedule( 'activity_1', test_activity_1) activity_2 = schedule( 'activity_2', test_activity_2, requires=[activity_1]) for i in range(3): activity_3 = schedule( 'activity-3.{}'.format(i), test_activity_3, requires=[activity_2]) if activity_3.ready and activity_2.result.get('4') == 4: last_activity = schedule( 'last_activity.{}'.format(i), test_activity_last, input=dict(the='end')) ``` Remember: the decider is called anytime you have an event has occurred. So this method should only be focused on scheduling (and nothing else). @rantonmattei
- Loading branch information
Showing
3 changed files
with
245 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters