From afb3a8c6b50ec090a5eb3886174312ce4046f263 Mon Sep 17 00:00:00 2001 From: Agah Date: Mon, 9 Oct 2023 01:29:58 -0400 Subject: [PATCH] Fix glob issue --- api/neurolibre_celery_tasks.py | 3 ++- api/preprint.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/neurolibre_celery_tasks.py b/api/neurolibre_celery_tasks.py index 116789e..47fd63b 100644 --- a/api/neurolibre_celery_tasks.py +++ b/api/neurolibre_celery_tasks.py @@ -805,6 +805,7 @@ def zenodo_publish_task(self, payload): gh_template_respond(github_client,"started",payload['task_title'], payload['review_repository'],payload['issue_id'],task_id,payload['comment_id']) response = zenodo_publish(payload['issue_id']) + if response == "no-record-found": msg = "
:neutral_face: I could not find any Zenodo-related records on NeuroLibre servers. Maybe start with roboneuro zenodo create buckets?" gh_template_respond(github_client,"failure",payload['task_title'], payload['review_repository'],payload['issue_id'],task_id,payload['comment_id'], msg) @@ -816,7 +817,7 @@ def zenodo_publish_task(self, payload): publish_status = zenodo_confirm_status(payload['issue_id'],"published") # If all items are published, success. Add DOIs. if publish_status[0]: - prompt = "First state that you will issue commands to set DOIs for the reproducibility assets, then you'll talk to yourself a bit. But reassure in a funny way that there's nothing to worry about because you are not an artificial general intelligence (yet)." + prompt = "First state that you will issue commands to set DOIs for the reproducibility assets, then you'll talk to yourself a bit. But reassure in a funny way that there's nothing to worry about because you are not an artificial general intelligence (yet). Keep it to a few sentences." gpt_response = get_gpt_response(prompt) gh_template_respond(github_client,"success",payload['task_title'], payload['review_repository'],payload['issue_id'],task_id,payload['comment_id'], f"Congrats! Reproducibility assets have been successfully archived and published :rocket: \n\n {gpt_response}", False) # Set DOIs. This part is a little crazy, because roboneuro will be diff --git a/api/preprint.py b/api/preprint.py index 94999ab..cbbd28c 100644 --- a/api/preprint.py +++ b/api/preprint.py @@ -486,7 +486,7 @@ def zenodo_collect_dois(issue_id): collect = {} for item in zenodo_record.keys(): tmp = glob.glob(os.path.join(get_deposit_dir(issue_id),f"zenodo_published_{item}_NeuroLibre_{issue_id:05d}_*.json")) - with open(tmp, 'r') as f: + with open(tmp[0], 'r') as f: tmp_record = json.load(f) collect[item] = tmp_record['doi_url'] return collect