Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logging_level = logging.INFO
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__)
def queue_experiments(db_collection_name, config_file, force_duplicates, no_hash=False, no_config_check=False):
seml_config, slurm_config, experiment_config = read_config(config_file)
# Use current Anaconda environment if not specified
if 'conda_environment' not in seml_config:
if 'CONDA_DEFAULT_ENV' in os.environ:
seml_config['conda_environment'] = os.environ['CONDA_DEFAULT_ENV']
else:
seml_config['conda_environment'] = None
# Set Slurm config with default parameters as fall-back option
if slurm_config is None:
slurm_config = {'sbatch_options': {}}
for k, v in SETTINGS.SLURM_DEFAULT['sbatch_options'].items():
if k not in slurm_config['sbatch_options']:
slurm_config['sbatch_options'][k] = v
del SETTINGS.SLURM_DEFAULT['sbatch_options']
for k, v in SETTINGS.SLURM_DEFAULT.items():