From d23c1455fa9c7ab00d03dc50422b27a43fd13bf7 Mon Sep 17 00:00:00 2001 From: Miquel Duran-Frigola Date: Tue, 27 Jun 2023 15:04:04 +0200 Subject: [PATCH] bugfix closing model from autoservice and update readme --- README.md | 15 +++++++++++---- ersilia/hub/bundle/status.py | 2 +- ersilia/serve/autoservice.py | 5 ++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 094aff76..b46cbd30 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ ## Project Description -The Ersilia Model Hub is a unified platform of pre-trained AI/ML models for infectious and neglected disease research. The end goal is to provide an open-source, no-code solution to access AI/ML models to accelerate drug discovery. The models embedded in the hub include both models published in the literature (with appropriate third party acknowledgement) and models developed by the Ersilia team or contributors. +The Ersilia Model Hub is a unified platform of pre-trained AI/ML models for infectious and neglected disease research. The end goal is to provide an open-source, low-code solution to access AI/ML models for **drug discovery**. The models embedded in the hub include both models published in the literature (with appropriate third party acknowledgement) and models developed by the Ersilia team or contributors. * Read more about the project in the [Ersilia Book](https://ersilia.gitbook.io/ersilia-book/) * Browse available models in the [Ersilia Model Hub](https://ersilia.io/model-hub/) @@ -29,7 +29,7 @@ Please check the package requirements in the [Installation Guide](https://ersili 1. Create a conda environment and activate it ```bash - conda create -n ersilia python=3.7 + conda create -n ersilia python=3.10 conda activate ersilia ``` @@ -59,10 +59,10 @@ Please check the package requirements in the [Installation Guide](https://ersili ersilia serve retrosynthetic-accessibility ``` -1. And run the prediction **API**: +1. And **run** the model: ```bash - ersilia api -i my_molecules.csv -o my_predictions.csv + ersilia run -i my_molecules.csv -o my_predictions.csv ``` 1. Finally, **close** the service when you are done. @@ -71,6 +71,13 @@ Please check the package requirements in the [Installation Guide](https://ersili ersilia close ``` +1. If you no longer want to use the model, you can **delete** it. + +```bash +ersilia delete retrosynthetic-accessibility +``` + + Please see the [Ersilia Book](https://ersilia.gitbook.io/ersilia-book/) for more examples and detailed explanations. ## Contribute diff --git a/ersilia/hub/bundle/status.py b/ersilia/hub/bundle/status.py index 9997b413..75e22e72 100644 --- a/ersilia/hub/bundle/status.py +++ b/ersilia/hub/bundle/status.py @@ -34,7 +34,7 @@ def is_docker(self, model_id): if docker.exists(self.cfg.EXT.DOCKERHUB_ORG, img, tag): return True return False - + def is_pulled_docker(self, model_id): model_dir = os.path.join(self._model_path(model_id=model_id)) json_file = os.path.join(model_dir, IS_FETCHED_FROM_DOCKERHUB_FILE) diff --git a/ersilia/serve/autoservice.py b/ersilia/serve/autoservice.py index 0ba74a2f..8fc6d839 100644 --- a/ersilia/serve/autoservice.py +++ b/ersilia/serve/autoservice.py @@ -313,7 +313,10 @@ def close(self): os.remove(tmp_file) self.clean_temp_dir() self.clean_docker_containers() - self.service.close() + try: + self.service.close() + except: # TODO: capture the error + pass def api( self, api_name, input, output=DEFAULT_OUTPUT, batch_size=DEFAULT_BATCH_SIZE