aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-07-14 14:15:59 -0500
committerFrederick Muriuki Muriithi2025-07-14 14:15:59 -0500
commitb3b7973ffc36261dc6d79be17c85efbd79c317fa (patch)
treef644e9765ea039eafa4eabe983ae08891e6c51b6
parent5424f696dce8e732ec447f7ff14f4f137e114029 (diff)
downloadgn-uploader-b3b7973ffc36261dc6d79be17c85efbd79c317fa.tar.gz
Handle case where authorisation is already set up.
-rw-r--r--scripts/load_phenotypes_to_db.py10
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):