diff options
author | Frederick Muriuki Muriithi | 2025-06-09 14:51:41 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-06-09 14:51:41 -0500 |
commit | 70e690e46642bd6e6a46eb2f806db45dfbed5541 (patch) | |
tree | 6b2cf3dbd10839032ff5932b211a0845bcba73e6 /scripts | |
parent | 0cbf07162e4669f43301f3b35b6f062a00d2ad29 (diff) | |
download | gn-uploader-70e690e46642bd6e6a46eb2f806db45dfbed5541.tar.gz |
Run the authorisation update requests.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/load_phenotypes_to_db.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py index 223a435..dc083cd 100644 --- a/scripts/load_phenotypes_to_db.py +++ b/scripts/load_phenotypes_to_db.py @@ -318,7 +318,26 @@ def update_auth(authserver, token, species, population, dataset, xrefdata): "data_link_ids": [ item["data_link_id"] for item in linkeddata["traits"]] }).then(lambda attc: (user, linkeddata, resource, attc)) - raise NotImplementedError("Please implement this!") + + def __handle_error__(resp): + 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()) + return 1 + + def __handle_success__(val): + logger.info( + "The authorisation for the data has been updated successfully.") + return 0 + + return __fetch_user_details__().then(__link_data__).then( + lambda result: __fetch_phenotype_category_details__(*result) + ).then( + lambda result: __create_resource__(*result) + ).then( + lambda result: __attach_data_to_resource__(*result) + ).either(__handle_error__, __handle_success__) def load_data(conn: mysqldb.Connection, job: dict) -> int: |