def prepare_for_launch(args):
    '\n    Load config, figure out working directory, create runner.\n        - when args.config_file is empty, returned cfg will be the default one\n        - returned output_dir will always be non empty, args.output_dir has higher\n            priority than cfg.OUTPUT_DIR.\n    '
    print(args)
    runner = create_runner(args.runner)
    cfg = runner.get_default_cfg()
    if args.config_file:
        with PathManager.open(reroute_config_path(args.config_file), 'r') as f:
            print('Loaded config file {}:\n{}'.format(args.config_file, f.read()))
        cfg.merge_from_file(args.config_file)
        cfg.merge_from_list(args.opts)
    else:
        cfg = create_cfg_from_cli_args(args, default_cfg=cfg)
    cfg.freeze()
    assert (args.output_dir or args.config_file)
    output_dir = (args.output_dir or cfg.OUTPUT_DIR)
    return (cfg, output_dir, runner)
Load config, figure out working directory, create runner.
    - when args.config_file is empty, returned cfg will be the default one
    - returned output_dir will always be non empty, args.output_dir has higher
        priority than cfg.OUTPUT_DIR.
def prepare_for_launch(args):
    '\n    Load config, figure out working directory, create runner.\n        - when args.config_file is empty, returned cfg will be the default one\n        - returned output_dir will always be non empty, args.output_dir has higher\n            priority than cfg.OUTPUT_DIR.\n    '
    print(args)
    runner = create_runner(args.runner)
    cfg = runner.get_default_cfg()
    if args.config_file:
        with PathManager.open(reroute_config_path(args.config_file), 'r') as f:
            print('Loaded config file {}:\n{}'.format(args.config_file, f.read()))
        cfg.merge_from_file(args.config_file)
        cfg.merge_from_list(args.opts)
    else:
        cfg = create_cfg_from_cli_args(args, default_cfg=cfg)
    cfg.freeze()
    assert (args.output_dir or args.config_file)
    output_dir = (args.output_dir or cfg.OUTPUT_DIR)
    return (cfg, output_dir, runner)