Skip to content

Commit

Permalink
Merge pull request #195 from broadinstitute/improve-conda-logging
Browse files Browse the repository at this point in the history
improve conda install logging
  • Loading branch information
tomkinsc committed Jan 14, 2016
2 parents dbea5a9 + fe9c024 commit d240b24
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tools/__init__.py
Expand Up @@ -264,21 +264,36 @@ def _attempt_install(self):
python_version = "python=" + python_version if python_version else ""
run_cmd.extend([python_version])

result = util.misc.run_and_print(run_cmd, silent=True)
data = json.loads(result.stdout.decode("UTF-8"))
result = util.misc.run_and_print(run_cmd, silent=False)
try:
data = json.loads(result.stdout.decode("UTF-8"))
#data = json.loads("!!\"")
except:
_log.warning("failed to decode JSON output from conda create: %s", result.stdout.decode("UTF-8"))
self.installed = False
return

if "error" in data.keys() and "prefix already exists" in data["error"]:
# the environment already exists
# the package may not be installed...
_log.debug("Conda environment already exists...")

result = util.misc.run_and_print(
[
"conda", "install", "--json", "-c", self.channel, "-y", "-q", "-p", self.env_path,
self._package_str
],
silent=True
)

if result.returncode == 0:
data = json.loads(result.stdout.decode("UTF-8"))
try:
data = json.loads(result.stdout.decode("UTF-8"))
except:
_log.warning("failed to decode JSON output from conda install: %s", result.stdout.decode("UTF-8"))
self.installed = False
return

if data["success"] == True:
# set self.installed = True
self.verify_install()
Expand Down

0 comments on commit d240b24

Please sign in to comment.