in dora/__main__.py [0:0]
def get_parser():
parser = argparse.ArgumentParser()
module = os.environ.get('DORA_PACKAGE')
main_module = os.environ.get('DORA_MAIN_MODULE') or 'train'
parser.add_argument(
'--package', '-P',
default=module,
help='Training module. '
'You can also set the DORA_PACKAGE env. In last resort, '
'Dora will look for a package in the current folder with module defined '
'at --runfile flag.')
parser.add_argument(
'--main_module',
default=main_module,
help='Training exec name. '
'Dora will search for this module to run within the package provided by --package '
'flag. You can also set DORA_MAIN_MODULE env. Defaults to \'train\' module.')
parser.add_argument('--verbose', '-v', action='store_true', help="Show debug info.")
subparsers = parser.add_subparsers(
title="command", help="Command to execute", required=True, dest='command')
grid = subparsers.add_parser("grid")
add_submit_rules(grid)
add_slurm_config(grid)
grid.add_argument("-C", "--cancel", action='store_true',
help="Cancel all running jobs.")
grid.add_argument("--clear", action='store_true',
help="Remove XP folder, reschedule all jobs, starting from scratch.")
grid.add_argument("-i", "--interval", default=5, type=float,
help="Update status and metrics every that number of minutes. "
"Default is 5 min.")
grid.add_argument("--no_monitoring", action="store_false", dest="monitor",
help="No monitoring, just schedule and print current state.")
grid.add_argument("--dry_run", action="store_true",
help="Only simulate actions but does not run any call to Slurm.")
grid.add_argument("-T", "--trim", type=int,
help="Trim history to the length of the exp with the given index.")
grid.add_argument("-L", "--trim_last", action="store_true",
help="Trim history to the slowest.")
group = grid.add_mutually_exclusive_group()
group.add_argument("-f", "--folder", type=int,
help="Show the folder for the job with the given index")
group.add_argument("-l", "--log", type=int,
help="Show the log for the job with the given index")
group.add_argument("-t", "--tail", type=int,
help="Show the log for the job with the given index")
group.add_argument("--init", action='store_true',
help="Init the given XPs so that their signature can be referenced.")
grid.add_argument(
'grid', nargs='?',
help='Name of the grid to run. Name of the module will be `package`.grids.`name`.')
grid.add_argument("patterns", nargs='*',
help="Only handle experiments matching all the given pattern. "
"If empty, handle all experiments")
grid.set_defaults(action=grid_action)
run = subparsers.add_parser("run", help="Run locally the given command.")
run.add_argument("-f", "--from_sig", help="Signature of job to use as baseline.")
run.add_argument("-d", "--ddp", action="store_true", help="Distributed training.")
run.add_argument("--git_save", action="store_true", default=False,
help="Run from a clean git clone.")
run.add_argument("--clear", action='store_true',
help="Remove XP folder, reschedule job, starting from scratch.")
run.add_argument("argv", nargs='*')
run.set_defaults(action=run_action)
launch = subparsers.add_parser("launch")
launch.add_argument("-f", "--from_sig", help="Signature of job to use as baseline.")
launch.add_argument("-a", "--attach", action="store_true",
help="Attach to the remote process. Interrupting the command will "
"kill the remote job.")
launch.add_argument("--no_tail", action="store_false", dest="tail", default=True,
help="Does not tail the log once job is started.")
launch.add_argument("-C", "--cancel", action='store_true',
help="Cancel any existing job and return.")
launch.add_argument("--clear", action='store_true',
help="Remove XP folder, reschedule job, starting from scratch.")
add_submit_rules(launch)
add_slurm_config(launch)
launch.add_argument("argv", nargs='*')
launch.set_defaults(action=launch_action)
info = subparsers.add_parser("info")
info.add_argument("-f", "--from_sig", help="Signature of job to use as baseline.")
info.add_argument("-j", "--job_id", help="Find job by job id.")
info.add_argument("-C", "--cancel", action="store_true", help="Cancel job")
info.add_argument("-l", "--log", action="store_true", help="Show entire log")
info.add_argument("-t", "--tail", action="store_true", help="Tail log")
info.add_argument("-m", "--metrics", action="store_true", help="Show last metrics")
info.add_argument("argv", nargs='*')
info.set_defaults(action=info_action)
import_ = subparsers.add_parser("import")
import_.set_defaults(action=import_action)
export = subparsers.add_parser("export")
export.add_argument("sigs", nargs='*', help='All the XP sigs to export.')
export.set_defaults(action=export_action)
return parser