diff options
author | Frederick Muriuki Muriithi | 2025-07-14 14:15:59 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-07-14 14:15:59 -0500 |
commit | b3b7973ffc36261dc6d79be17c85efbd79c317fa (patch) | |
tree | f644e9765ea039eafa4eabe983ae08891e6c51b6 | |
parent | 5424f696dce8e732ec447f7ff14f4f137e114029 (diff) | |
download | gn-uploader-b3b7973ffc36261dc6d79be17c85efbd79c317fa.tar.gz |
Handle case where authorisation is already set up.
-rw-r--r-- | scripts/load_phenotypes_to_db.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py index 8855c4c..c1a7687 100644 --- a/scripts/load_phenotypes_to_db.py +++ b/scripts/load_phenotypes_to_db.py @@ -313,10 +313,18 @@ def update_auth(# pylint: disable=[too-many-locals,too-many-positional-arguments }).then(lambda attc: (user, linkeddata, resource, attc)) def __handle_error__(resp): + error = resp.json() + if error.get("error") == "IntegrityError": + # This is hacky. If the auth already exists, something went wrong + # somewhere. + # This needs investigation to recover correctly. + logger.info( + "The authorisation for the data was already set up.") + return 0 logger.error("ERROR: Updating the authorisation for the data failed.") logger.debug( "ERROR: The response from the authorisation server was:\n\t%s", - resp.json()) + error) return 1 def __handle_success__(_val): |