Skip to content
Permalink
Browse files
fix: fix singularity logging messages causing conda fail (#1523)
* fix singularity logging messages causing conda fail

* fix: only use STDOUT for conda version (conda prints version to STDOUT since at least 5 years now).

* handling stderr on error

Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
  • Loading branch information
TanguyLallemand and johanneskoester committed Mar 28, 2022
1 parent 3d4c768 commit 77975952ce7df346729f76a767ad4f475b385306
Showing 1 changed file with 8 additions and 11 deletions.
@@ -624,19 +624,16 @@ def _check(self):
try:
version = shell.check_output(
self._get_cmd("conda --version"),
stderr=subprocess.STDOUT,
stderr=subprocess.PIPE,
universal_newlines=True,
)
if self.container_img:
version = "\n".join(
filter(
lambda line: not line.startswith("WARNING:")
and not line.startswith("ERROR:"),
version.splitlines(),
)
version_matches = re.findall("\d+.\d+.\d+", version)
if len(version_matches) != 1:
raise WorkflowError(
f"Unable to determine conda version. 'conda --version' returned {version}"
)

version = version.split()[1]
else:
version = version_matches[0]
if StrictVersion(version) < StrictVersion("4.2"):
raise CreateCondaEnvironmentException(
"Conda must be version 4.2 or later, found version {}.".format(
@@ -645,7 +642,7 @@ def _check(self):
)
except subprocess.CalledProcessError as e:
raise CreateCondaEnvironmentException(
"Unable to check conda version:\n" + e.output.decode()
"Unable to check conda version:\n" + e.stderr.decode()
)

def bin_path(self):

0 comments on commit 7797595

Please sign in to comment.