Skip to content

Commit

Permalink
Fix for NCBI downloads to avoid timing out when requesting data too c…
Browse files Browse the repository at this point in the history
…lose to today's date
  • Loading branch information
atc3 committed May 23, 2024
1 parent 9b338a7 commit 1f13984
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions workflow_flu_genbank_ingest/scripts/download_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"""

import argparse
import datetime
import requests

RETRY_ATTEMPTS = 5
Expand All @@ -147,6 +148,12 @@ def main():
)
args = parser.parse_args()

# NCBI doesn't like an end date even close to today
# so set the maximum end date to today minus 14 days
max_date = (datetime.datetime.now() - datetime.timedelta(days=14)).isoformat()
if args.end_time > max_date:
args.end_time = max_date

endpoint = "https://www.ncbi.nlm.nih.gov/genomes/VirusVariation/vvsearch2/"
params = {
# Search criteria
Expand Down
7 changes: 7 additions & 0 deletions workflow_flu_genbank_ingest/scripts/download_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@


import argparse
import datetime
import requests

RETRY_ATTEMPTS = 5
Expand All @@ -55,6 +56,12 @@ def main():
)
args = parser.parse_args()

# NCBI doesn't like an end date even close to today
# so set the maximum end date to today minus 14 days
max_date = (datetime.datetime.now() - datetime.timedelta(days=14)).isoformat()
if args.end_time > max_date:
args.end_time = max_date

endpoint = "https://www.ncbi.nlm.nih.gov/genomes/VirusVariation/vvsearch2/"
params = {
# Search criteria
Expand Down
7 changes: 7 additions & 0 deletions workflow_rsv_genbank_ingest/scripts/download_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@


import argparse
import datetime
import requests

RETRY_ATTEMPTS = 5
Expand All @@ -46,6 +47,12 @@ def main():
)
args = parser.parse_args()

# NCBI doesn't like an end date even close to today
# so set the maximum end date to today minus 14 days
max_date = (datetime.datetime.now() - datetime.timedelta(days=14)).isoformat()
if args.end_time > max_date:
args.end_time = max_date

endpoint = "https://www.ncbi.nlm.nih.gov/genomes/VirusVariation/vvsearch2/"
params = {
# Search criteria
Expand Down
7 changes: 7 additions & 0 deletions workflow_rsv_genbank_ingest/scripts/download_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@


import argparse
import datetime
import requests

RETRY_ATTEMPTS = 5
Expand All @@ -55,6 +56,12 @@ def main():
)
args = parser.parse_args()

# NCBI doesn't like an end date even close to today
# so set the maximum end date to today minus 14 days
max_date = (datetime.datetime.now() - datetime.timedelta(days=14)).isoformat()
if args.end_time > max_date:
args.end_time = max_date

endpoint = "https://www.ncbi.nlm.nih.gov/genomes/VirusVariation/vvsearch2/"
params = {
# Search criteria
Expand Down
7 changes: 7 additions & 0 deletions workflow_sars2_genbank_ingest/scripts/download_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"""

import argparse
import datetime
import requests

RETRY_ATTEMPTS = 5
Expand All @@ -45,6 +46,12 @@ def main():
)
args = parser.parse_args()

# NCBI doesn't like an end date even close to today
# so set the maximum end date to today minus 14 days
max_date = (datetime.datetime.now() - datetime.timedelta(days=14)).isoformat()
if args.end_time > max_date:
args.end_time = max_date

endpoint = "https://www.ncbi.nlm.nih.gov/genomes/VirusVariation/vvsearch2/"
params = {
# Search criteria
Expand Down
7 changes: 7 additions & 0 deletions workflow_sars2_genbank_ingest/scripts/download_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@


import argparse
import datetime
import requests

RETRY_ATTEMPTS = 5
Expand All @@ -55,6 +56,12 @@ def main():
)
args = parser.parse_args()

# NCBI doesn't like an end date even close to today
# so set the maximum end date to today minus 14 days
max_date = (datetime.datetime.now() - datetime.timedelta(days=14)).isoformat()
if args.end_time > max_date:
args.end_time = max_date

endpoint = "https://www.ncbi.nlm.nih.gov/genomes/VirusVariation/vvsearch2/"
params = {
# Search criteria
Expand Down

0 comments on commit 1f13984

Please sign in to comment.