Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hdlr = logging.StreamHandler(sys.stderr)
hdlr.setFormatter(LoggingFormatter())
logging.root.addHandler(hdlr)
logging.root.setLevel(logging_level)
if args.func == mongodb_credentials_prompt: # launch SEML configure.
del args.db_collection_name
else: # otherwise remove the flag as it is not used elsewhere.
if not args.db_collection_name:
parser.error("the following arguments are required: db_collection_name")
else:
if os.path.isfile(args.db_collection_name):
logging.warning("Loading the collection name from a config file. This has been deprecated. "
"Please instead provide a database collection name in the command line.")
seml_config, _, _ = read_config(args.db_collection_name)
if args.func == queue_experiments:
args.config_file = args.db_collection_name
args.db_collection_name = seml_config['db_collection']
elif args.func == queue_experiments and not args.config_file:
parser_queue.error("the following arguments are required: config_file")
f = args.func
del args.func
del args.verbose
if 'filter_states' in args:
args.filter_states = [state.upper() for state in args.filter_states]
f(**args.__dict__)
help="Path to the YAML configuration file for the experiment.")
parser_queue.add_argument(
'-nh', '--no-hash', action='store_true',
help="Do not use the hash of the config dictionary to filter out duplicates (by comparing all"
"dictionary values individually). This is much slower, so use only if you have a good reason not to"
" use the hash.")
parser_queue.add_argument(
'-nc', '--no-config-check', action='store_true',
help="Do not check the config for missing/unused arguments. "
"Use this if the check fails unexpectedly when using "
"advanced Sacred features or to accelerate queueing.")
parser_queue.add_argument(
'-f', '--force-duplicates', action='store_true',
help="Add experiments to the database even when experiments with identical configurations "
"are already in the database.")
parser_queue.set_defaults(func=queue_experiments)
parser_start = subparsers.add_parser(
"start",
help="Fetch queued experiments from the database and run them (by default via Slurm).")
parser_start.add_argument(
'-l', '--local', action='store_true',
help="Run the experiments locally (not via Slurm).")
parser_start.add_argument(
'-n', '--num-exps', type=int, default=-1,
help="Only start the specified number of experiments.")
parser_start.add_argument(
'-u', '--unobserved', action='store_true',
help="Run the experiments without Sacred observers (no changes to the database). "
"This also disables output capturing by Sacred, facilitating the use of debuggers (pdb, ipdb).")
parser_start.add_argument(
'-pm', '--post-mortem', action='store_true',