diff --git a/fleetrec/core/utils/envs.py b/fleetrec/core/utils/envs.py index 2aa6951e468887a3b23a462cdb5f0de41925f96b..e4a04440f403fa9c7a9357fd7424bdb6a058e9f1 100644 --- a/fleetrec/core/utils/envs.py +++ b/fleetrec/core/utils/envs.py @@ -22,14 +22,18 @@ def set_runtime_envions(envs): assert isinstance(envs, dict) def fatten_env_namespace(namespace_nests, local_envs): - for k, v in local_envs.items(): - if isinstance(v, dict): - nests = copy.deepcopy(namespace_nests) - nests.append(k) - fatten_env_namespace(nests, v) - else: - global_k = ".".join(namespace_nests + [k]) - os.environ[global_k] = str(v) + if not isinstance(local_envs, dict): + global_k = ".".join(namespace_nests) + os.environ[global_k] = str(local_envs) + else: + for k, v in local_envs.items(): + if isinstance(v, dict): + nests = copy.deepcopy(namespace_nests) + nests.append(k) + fatten_env_namespace(nests, v) + else: + global_k = ".".join(namespace_nests + [k]) + os.environ[global_k] = str(v) for k, v in envs.items(): fatten_env_namespace([k], v) diff --git a/fleetrec/run.py b/fleetrec/run.py index 51c8a583e7875cbe19db0431f572c186614b8350..e0afe5a1b041bc05fad0143bfaec6299fc853713 100644 --- a/fleetrec/run.py +++ b/fleetrec/run.py @@ -26,7 +26,7 @@ def set_runtime_envs(cluster_envs, engine_yaml): need_print = {} for k, v in os.environ.items(): - if k.startswith() == "trainer.": + if k.startswith("trainer."): need_print[k] = v print(envs.pretty_print_envs(need_print, ("Runtime Envs", "Value")))