提交 cd1c7933 编写于 作者: T tangwei

fix bug

上级 f24182e6
......@@ -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)
......
......@@ -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")))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册