Skip to content

Commit

Permalink
add conda env to log
Browse files Browse the repository at this point in the history
  • Loading branch information
urmi-21 committed Apr 27, 2020
1 parent 84ce1c5 commit 2e3a027
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pyrpipe/pyrpipe_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,23 @@ def init_envlog(self):
pyver='Python ' + sys.version.replace('\n', '')
#get cpu
cpu=str(cpu_count())+' logical CPU cores'
#get conda env
condaenv_cmd='conda env export'
result = subprocess.Popen(condaenv_cmd.split(),stdout=subprocess.PIPE,stderr=subprocess.STDOUT,)
stdout,stderr = result.communicate()
condaenv=stdout.decode("utf-8")
#remove prefix line
condaenv='\n'.join([ x for x in condaenv.split('\n') if x and 'prefix' not in x ])
#print(condaenv)


envDesc={'now':str(datetime.now().strftime("%y-%m-%d %H:%M:%S")),
'python':pyver,
'os':osInfo,
'cpu':cpu,
'syspath':str(sys.path),
'sysmodules':str(list(sys.modules.keys()))
'sysmodules':str(list(sys.modules.keys())),
'conda_env':str(condaenv)
}

self.env_logger.debug(json.dumps(envDesc))
Expand Down

0 comments on commit 2e3a027

Please sign in to comment.