Log env vars starting with * in environ_bind.py (#459)

This commit is contained in:
Radu Grosu 2021-09-22 20:44:33 +01:00 committed by GitHub
parent dd3d4cec94
commit 4955c7a784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,14 +41,17 @@ class EnvironmentBind(object):
return
env_param = dict()
for match in (environ_log or []):
for match in environ_log:
match = match.strip()
if match == '*':
env_param.update({k: os.environ.get(k) for k in os.environ
if not k.startswith('TRAINS_') and not k.startswith('CLEARML_')})
elif match.endswith('*'):
match = match.strip('*')
match = match.rstrip('*')
env_param.update({k: os.environ.get(k) for k in os.environ if k.startswith(match)})
elif match.startswith('*'):
match = match.lstrip('*')
env_param.update({k: os.environ.get(k) for k in os.environ if k.endswith(match)})
elif match in os.environ:
env_param.update({match: os.environ.get(match)})
# store os environments