From 0a4edf970de0e7eb43abfc36a2603ad6f3b3198a Mon Sep 17 00:00:00 2001 From: GemmaTuron Date: Fri, 22 Dec 2023 11:05:48 +0100 Subject: [PATCH] improve print debugs delete file --- ersilia/hub/delete/delete.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ersilia/hub/delete/delete.py b/ersilia/hub/delete/delete.py index 586276980..e579ddbbd 100644 --- a/ersilia/hub/delete/delete.py +++ b/ersilia/hub/delete/delete.py @@ -39,7 +39,7 @@ def delete(self, model_id): folder = self._model_path(model_id) if not os.path.exists(folder): return - self.logger.info("Removing folder {0}".format(folder)) + self.logger.info("Removing EOS folder {0}".format(folder)) rmtree(folder) @@ -67,7 +67,9 @@ def delete_public(self, model_id): self.delete_if_exists(path) def delete(self, model_id): + self.logger.debug("Attempting lake delete (local)") self.delete_local(model_id) + self.logger.debug("Attempting lake delete (public)") self.delete_public(model_id) @@ -80,10 +82,11 @@ def _model_path(self, model_id): return folder def delete(self, model_id): + self.logger.debug("Attempting temporary folder delete") folder = self._model_path(model_id) if not os.path.exists(folder): return - self.logger.info("Removing folder {0}".format(folder)) + self.logger.info("Removing temporary folder {0}".format(folder)) shutil.rmtree(folder) @@ -104,23 +107,25 @@ def delete(self, model_id): self.logger.info("Removing bento folder first {0}".format(bento_folder)) rmtree(bento_folder) os.makedirs(bento_folder, exist_ok=True) - self.logger.info("Removing folder {0}".format(folder)) + self.logger.info("Removing bundle folder {0}".format(folder)) rmtree(folder) + self.logger.debug("Folder removed") class ModelBentoDeleter(ErsiliaBase): def __init__(self, config_json=None): ErsiliaBase.__init__(self, config_json=config_json) - @staticmethod - def _delete_service(service): + def _delete_service(self, service): cmd = "echo yes | bentoml delete %s" % service + self.logger.debug(cmd) run_command(cmd) def _delete(self, model_id, keep_latest=True): ml = ModelCatalog() try: catalog = ml.bentoml() + self.logger.debug(catalog) except: self.logger.debug("No BentoML Catalog available") catalog = None @@ -136,6 +141,7 @@ def _delete(self, model_id, keep_latest=True): self._delete_service(service) def delete(self, model_id): + self.logger.debug("Attempting Bento delete") self._delete(model_id, keep_latest=False) def clean(self, model_id):