"""{{cookiecutter.flow_name}} workflow.""" from garcon import runner from {{cookiecutter.app_name}}.flows.base_flow import BaseFlow from {{cookiecutter.app_name}}.flows.{{cookiecutter.flow_name}} import config from {{cookiecutter.app_name}}.flows.{{cookiecutter.flow_name}} import tasks class Flow(BaseFlow): """Class representing the workflow.""" timeout = 12 * 60 def __init__(self): """Initialize flow object.""" super(Flow, self).__init__( flow_name=config.SWF_FLOW_NAME, version=config.SWF_FLOW_VERSION) def decider(self, schedule, context): """Activity decider. Args: schedule (callable): The scheduler method. """ bootstrap = schedule('bootstrap', self.bootstrap) if bootstrap.result.get('bootstrap.example'): schedule( 'example', self.example, requires=[bootstrap]) @property def bootstrap(self): """Bootstrap initial configuration.""" return self.create( name='bootstrap', tasks=runner.Sync( tasks.bootstrap.fill( namespace='bootstrap', date='context_date', example='example',))) @property def example(self): """Bootstrap initial configuration.""" return self.create( name='example', tasks=runner.Sync( tasks.example_task.fill( namespace='example')))