def main(args=None): if not args: args, pass_throughs = parse_args() else: args, pass_throughs = parse_args(args) if args.debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) if args.subparser_name == 'submit': args_dict = args.__dict__ if not args_dict.get('config_root_dir'): args_dict['config_root_dir'] = args_dict['base_name'] execute.submit(pass_throughs=pass_throughs, **args_dict) elif args.subparser_name == 'bootstrap': execute.bootstrap(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'one-off': execute.submit_one_off(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'batch': execute.submit_batch(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'rm': execute.rm_pipeline(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'trigger': execute.trigger_pipeline(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'abort': execute.abort_pipeline(pass_throughs=pass_throughs, **args.__dict__) else: # this is here so that if future subcommands are added, you don't forget to add a bit # here to enable them. raise NotImplementedError("Command {} is not implemented".format( args.subparser_name))
def test_submit_one_off(mocker): check_call = mocker.patch.object(execute.subprocess, 'check_call') execute.submit_one_off('frank', os.path.join(test_data_dir, 'one-off-recipes'), folders=('bzip2', 'pytest', 'pytest-cov'), config_root_dir=test_config_dir) # basically what we're checking here is that the config_overrides have been passed correctly check_call.assert_has_calls([ mocker.call([ 'rsync', '--delete', '-av', '-e', mocker.ANY, # ssh command that we don't care about much mocker.ANY, # temp source directory that we don't care about mocker.ANY, # -p (makes chmod flags work) mocker.ANY, # chmod flags ( 'your-intermediate-user@your-intermediate-server:' # this is what we care about. The middle entry here # needs 'test' replaced with 'frank'. Also, we're syncing a # plan and recipe folder, not a config folder '/ci/frank/plan_and_recipes') ]) ])
def main(args=None): if not args: args = parse_args() else: args = parse_args(args) if args.debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) if args.subparser_name == 'submit': args_dict = args.__dict__ if not args_dict.get('config_root_dir'): args_dict['config_root_dir'] = args_dict['base_name'] execute.submit(**args_dict) elif args.subparser_name == 'bootstrap': execute.bootstrap(**args.__dict__) elif args.subparser_name == 'examine': execute.compute_builds(**args.__dict__) elif args.subparser_name == 'one-off': execute.submit_one_off(**args.__dict__) else: # this is here so that if future subcommands are added, you don't forget to add a bit # here to enable them. raise NotImplementedError("Command {} is not implemented".format(args.subparser_name))