Skip to content

Commit 964fb7a

Browse files
nalinigansNalini Ganapati
and
Nalini Ganapati
authored
Second pass at retry for expired azure access tokens (#82)
Co-authored-by: Nalini Ganapati <[email protected]>
1 parent 7cdb67c commit 964fb7a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

genomicsdb/scripts/genomicsdb_query.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,20 +676,25 @@ def process(config):
676676
# exit out of the loop as the query has completed
677677
return 0
678678
except Exception as e:
679-
# Try handle read errors from TileDB storage for azure urls
679+
# Try to handle read errors with expired access tokens for azure urls
680680
# e.g. GenomicsDBIteratorException exception : Error while reading from TileDB array
681-
if allow_retry and "GenomicsDB" in str(type(e)) and "TileDB" in str(e):
681+
# VariantQueryProcessorException : Could not open array <array> at workspace <workspace>
682+
if allow_retry:
683+
if os.environ.get("GENOMICSDB_PRINT_EXCEPTION", None):
684+
logging.info(f"Exception({e}) encountered with genomicdb query")
682685
# Check for the possibility of an expired access token
683686
allow_retry = False
684687
try:
685688
# If the check for workspace under consideration succeeds and the workspace exists as it should,
686689
# genomicsdb instance is functional! Probably not an expired token, so re-raise outer exception
687690
if not gdb.workspace_exists(export_config.workspace):
688-
logging.info(f"Retrying query with a new instance of gdb for {msg}...")
691+
logging.info(f"Retrying after workspace check with a new instance of genomicsdb for {msg}...")
689692
gdb = None
690693
continue
691694
except Exception as ex:
692-
logging.info(f"Exception({ex}) encountered. Retrying query with a new instance of gdb for {msg}...")
695+
if os.environ.get("GENOMICSDB_PRINT_EXCEPTION", None):
696+
logging.info(f"Exception({ex}) encountered with genomicdb workspace check")
697+
logging.info(f"Retrying query with a new instance of genomicsdb for {msg}...")
693698
gdb = None
694699
continue
695700
logging.critical(f"Unexpected exception while processing {msg} : {e}")

0 commit comments

Comments
 (0)