How to use the dockerflow.flow.Flow.from_yaml function in dockerflow

To help you get started, we’ve selected a few dockerflow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github docker-archive / global-hack-day-3 / docker-flow / dockerflow / cli / main.py View on Github external
def main():  
    args = parse_args(sys.argv[1:])
    workflow_file = args.file
    workflow_name = os.path.basename(workflow_file).split('.')[0]
    build_dir = os.path.join(os.path.expanduser(args.build_dir), workflow_name)
    if not os.path.exists(workflow_file): 
        print 'workflow file {0} does not exist'.format(workflow_file)
        sys.exit(1)
    if not os.path.exists(build_dir): 
        print 'Creating docker-flow build directory {0}'.format(build_dir)
        os.makedirs(build_dir)
    print 'Building workflow from {0}'.format(workflow_file)
    workflow = Flow.from_yaml(workflow_file, context={"build_dir": build_dir})
    print 'Running jobs in workflow {0}'.format(workflow.name)
    workflow.run() 
    print 'Completed workflow {0}'.format(workflow.name)