#!/usr/bin/env python """Flow's exec. Run it with --help for usage.""" from feed_ingestion.flows.amazon_digital_services import config from feed_ingestion.util import exec_utils class FlowExec(exec_utils.FlowExecDaily): """Flow's exec.""" flow_name = config.feed_name def add_args(self): """Add args.""" licensor_choices = list(config.licensors) licensor_choices.append('ALL') exec_utils.add_licensor_arg( parser=self.parser, choices=licensor_choices, ) super().add_args() def generate_contexts(self): """Execute the flow.""" if self.args.licensor == 'ALL': licensors = config.licensors else: licensors = [self.args.licensor] for parent_context in super().generate_contexts(): for licensor in licensors: yield {**parent_context, 'licensor': licensor} if __name__ == '__main__': FlowExec().main()