in bayesmark/experiment_launcher.py [0:0]
def main():
"""See README for instructions on calling launcher.
"""
description = "Launch series of studies across functions and optimizers"
args = cmd.parse_args(cmd.launcher_parser(description))
logger.setLevel(logging.INFO) # Note this is the module-wide logger
if args[CmdArgs.verbose]:
logger.addHandler(logging.StreamHandler())
# Get optimizer settings, says which file to call for each optimizer
settings = cmd.load_optimizer_settings(args[CmdArgs.optimizer_root])
opt_file_lookup = {optimizer: wrapper_file for optimizer, (wrapper_file, _) in settings.items()}
# Setup uuid
if args[CmdArgs.uuid] is None:
args[CmdArgs.uuid] = pyuuid.uuid4().hex # debatable if uuid1 or uuid4 is better here
else:
warnings.warn(
"User UUID supplied. This is only desired for debugging. Careless use could lead to study id conflicts.",
UserWarning,
)
run_uuid = pyuuid.UUID(hex=args[CmdArgs.uuid])
assert run_uuid.hex == args[CmdArgs.uuid]
logger.info("Supply --uuid %s to reproduce this run." % run_uuid.hex)
# Log all the options
print("Launcher options (JSON):\n")
print(json.dumps({"bayesmark-launch-args": cmd.serializable_dict(args)}))
print("\n")
# Set the master seed (derive from the uuid we just setup)
pyrandom.seed(run_uuid.int)
np.random.seed(random_seed(pyrandom))
# Now run it, either to dry run file or executes sub-processes
if args[CmdArgs.dry_run]:
with absopen(args[CmdArgs.jobs_file], "w") as fp:
dry_run(args, opt_file_lookup, run_uuid, fp)
else:
timeout = args[CmdArgs.timeout] if args[CmdArgs.timeout] > 0 else None
real_run(args, opt_file_lookup, run_uuid, timeout)
logger.info("done")