Skip to content

Commit

Permalink
Explicitly set default min and max dates when missing - sometimes con…
Browse files Browse the repository at this point in the history
…fig.get can return None values??
  • Loading branch information
atc3 committed May 23, 2024
1 parent da30d62 commit 9b338a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions workflow_flu_genbank_ingest/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ data_folder = os.path.join("..", config["data_folder"])
static_data_folder = os.path.join("..", config["static_data_folder"])

min_date = pd.to_datetime(config.get('min_date', '2019-12-01'))
if min_date is None:
min_date = '2019-12-01'
max_date = pd.to_datetime(datetime.date.today().isoformat())
if max_date is None:
max_date = datetime.date.today().isoformat()

chunks = [d for d in pd.period_range(start=min_date, end=max_date, freq=config.get('dl_chunk_period', 'W'))]
DL_CHUNKS = [i for i in range(len(chunks))]
Expand Down
4 changes: 4 additions & 0 deletions workflow_rsv_genbank_ingest/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ data_folder = os.path.join("..", config["data_folder"])
static_data_folder = os.path.join("..", config["static_data_folder"])

min_date = pd.to_datetime(config.get('min_date', '2019-12-01'))
if min_date is None:
min_date = '2019-12-01'
max_date = pd.to_datetime(datetime.date.today().isoformat())
if max_date is None:
max_date = datetime.date.today().isoformat()

chunks = [d for d in pd.period_range(start=min_date, end=max_date, freq=config.get('dl_chunk_period', 'W'))]
DL_CHUNKS = [i for i in range(len(chunks))]
Expand Down
4 changes: 4 additions & 0 deletions workflow_sars2_genbank_ingest/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ rule all:
metadata = os.path.join(data_folder, "metadata.csv")

min_date = pd.to_datetime(config.get('min_date', '2019-12-01'))
if min_date is None:
min_date = '2019-12-01'
max_date = pd.to_datetime(config.get('end_date_cutoff', datetime.date.today().isoformat()))
if max_date is None:
max_date = datetime.date.today().isoformat()

chunks = [d for d in pd.period_range(start=min_date, end=max_date, freq=config.get('dl_chunk_period', 'W'))]
DL_CHUNKS = [i for i in range(len(chunks))]
Expand Down

0 comments on commit 9b338a7

Please sign in to comment.