From ef661d8404915ed3f1bf739b1d3d7ff67b3966aa Mon Sep 17 00:00:00 2001 From: Miquel Duran-Frigola Date: Fri, 1 Dec 2023 16:34:43 +0100 Subject: [PATCH] capture no matching manifest and trying AMD --- ersilia/hub/pull/pull.py | 14 ++++++++++++-- ersilia/io/output.py | 12 ++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ersilia/hub/pull/pull.py b/ersilia/hub/pull/pull.py index c5e528789..810d7dfc5 100644 --- a/ersilia/hub/pull/pull.py +++ b/ersilia/hub/pull/pull.py @@ -1,5 +1,7 @@ import requests import subprocess +import tempfile +import os from ... import ErsiliaBase from ...utils.terminal import yes_no_input, run_command @@ -102,11 +104,19 @@ def pull(self): self.logger.debug( "Trying to pull image {0}/{1}".format(DOCKERHUB_ORG, self.model_id) ) + tmp_file = os.path.join( + tempfile.mkdtemp(prefix="ersilia-"), "docker_pull.log" + ) run_command( - "docker pull {0}/{1}:{2}".format( - DOCKERHUB_ORG, self.model_id, DOCKERHUB_LATEST_TAG + "docker pull {0}/{1}:{2} 2>&1 > {3}".format( + DOCKERHUB_ORG, self.model_id, DOCKERHUB_LATEST_TAG, tmp_file ) ) + with open(tmp_file, "r") as f: + pull_log = f.read() + self.logger.log(pull_log) + if "no matching manifest" in pull_log: + raise Exception self.logger.debug("Image pulled succesfully!") except: self.logger.warning( diff --git a/ersilia/io/output.py b/ersilia/io/output.py index 1ebf2abd4..110653dca 100644 --- a/ersilia/io/output.py +++ b/ersilia/io/output.py @@ -210,11 +210,19 @@ def __expand_output_keys(self, vals, output_keys): t = current_pure_dtype[ok] self.logger.debug("Datatype: {0}".format(t)) if t in self._array_types: - self.logger.debug("Datatype has been matched: {0} over {1}".format(t, self._array_types)) + self.logger.debug( + "Datatype has been matched: {0} over {1}".format( + t, self._array_types + ) + ) assert m is not None if v is not None: if len(m) > len(v): - self.logger.debug("Metadata {0} is longer than values {1}".format(len(m), len(v))) + self.logger.debug( + "Metadata {0} is longer than values {1}".format( + len(m), len(v) + ) + ) v = list(v) + [None] * (len(m) - len(v)) assert len(m) == len(v) if merge_key: