mirror of https://github.com/inclusionAI/AReaL
fix config reader for cli
This commit is contained in:
parent
0bd9969ec4
commit
f686048f5f
|
@ -131,8 +131,9 @@ def prepare_hydra_config(name: str, prologue_path: str):
|
|||
experiment_name = get_experiment_name(config.get("experiment_name"))
|
||||
trial_name = get_trial_name(config.get("trial_name"))
|
||||
config_dir = f"{cluster_spec.fileroot}/configs/{getpass.getuser()}/{experiment_name}/{trial_name}"
|
||||
os.makedirs(config_dir, exist_ok=True)
|
||||
|
||||
config.pop(PROLOGUE_EXTERNAL_CONFIG_NAME)
|
||||
config.pop(PROLOGUE_EXTERNAL_CONFIG_NAME, {})
|
||||
with open(f"{config_dir}/{name}.yaml", "w") as f:
|
||||
f.write(OmegaConf.to_yaml(config))
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ def global_init():
|
|||
return
|
||||
|
||||
# add externel envs.
|
||||
if external_configs.envs is not None:
|
||||
if external_configs.get("envs"):
|
||||
for key, value in external_configs.envs.items():
|
||||
if key not in os.environ:
|
||||
os.environ[key] = value
|
||||
|
@ -38,8 +38,8 @@ def global_init():
|
|||
# resolve config path for cluster spec.
|
||||
cluster_spec_path = os.environ.get("CLUSTER_SPEC_PATH", "")
|
||||
if cluster_spec_path == "":
|
||||
if external_configs.cluster_config is not None:
|
||||
fileroot = external_configs.cluster_config.fileroot
|
||||
if external_configs.get("cluster_config"):
|
||||
fileroot = external_configs.cluster_config.get("fileroot")
|
||||
if fileroot is not None and fileroot != "":
|
||||
experiment_name = get_experiment_name(config.get("experiment_name"))
|
||||
trial_name = get_trial_name(config.get("trial_name"))
|
||||
|
|
Loading…
Reference in New Issue