From 83fa6c6f51aaf8fbc19e057048f27386b6f6f772 Mon Sep 17 00:00:00 2001 From: Evan Morris Date: Thu, 18 Jul 2024 17:29:31 -0400 Subject: [PATCH] making retries slower and nameres timeout longer --- parsers/LitCoin/src/NER/nameres.py | 2 +- parsers/LitCoin/src/bagel.py | 6 +++--- parsers/LitCoin/src/predicate_mapping.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/parsers/LitCoin/src/NER/nameres.py b/parsers/LitCoin/src/NER/nameres.py index ed7ffa4b..15c86971 100644 --- a/parsers/LitCoin/src/NER/nameres.py +++ b/parsers/LitCoin/src/NER/nameres.py @@ -30,7 +30,7 @@ def annotate(self, text, props, limit=1): if props.get('skip_umls', False): skip_umls = True - timeout = props.get('timeout', 10) # Default to 10 seconds + timeout = props.get('timeout', 15) # Default to 10 seconds # Make a request to Nemo-Serve. nameres_options = { diff --git a/parsers/LitCoin/src/bagel.py b/parsers/LitCoin/src/bagel.py index 8520c758..df66ae67 100644 --- a/parsers/LitCoin/src/bagel.py +++ b/parsers/LitCoin/src/bagel.py @@ -9,9 +9,9 @@ # output of parse_gpt looks like {"entity": triple["object"], "qualifier": triple["object_qualifier"]} session = requests.Session() -retries = Retry(total=5, - backoff_factor=0.1, - status_forcelist=[502, 503, 504, 429]) +retries = Retry(total=8, + backoff_factor=.75, + status_forcelist=[502, 503, 504, 520, 429]) session.mount('http://', HTTPAdapter(max_retries=retries)) session.mount('https://', HTTPAdapter(max_retries=retries)) nameres = NameResNEREngine(session) diff --git a/parsers/LitCoin/src/predicate_mapping.py b/parsers/LitCoin/src/predicate_mapping.py index 64a9eb55..d19c1251 100644 --- a/parsers/LitCoin/src/predicate_mapping.py +++ b/parsers/LitCoin/src/predicate_mapping.py @@ -28,9 +28,9 @@ def __init__(self, logger, workspace_dir='./workspace'): self.workspace_dir = workspace_dir session = requests.Session() - retries = Retry(total=5, - backoff_factor=0.1, - status_forcelist=[502, 503, 504, 429]) + retries = Retry(total=8, + backoff_factor=.75, + status_forcelist=[502, 503, 504, 520, 429]) session.mount('http://', HTTPAdapter(max_retries=retries)) session.mount('https://', HTTPAdapter(max_retries=retries)) self.requests_session = session