Skip to content

Commit 20b44c4

Browse files
Update notice_fetch_by_date_workflow.py
1 parent 71b9960 commit 20b44c4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

dags/notice_fetch_by_date_workflow.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from datetime import timedelta
2+
13
from airflow.decorators import dag, task
24
from airflow.operators.dummy import DummyOperator
35
from airflow.operators.python import BranchPythonOperator, PythonOperator
@@ -58,7 +60,9 @@ def validate_fetched_notices():
5860
from datetime import datetime
5961
from pymongo import MongoClient
6062

61-
publication_date = datetime.strptime(get_dag_param(key=WILD_CARD_DAG_KEY), "%Y%m%d*")
63+
publication_date = datetime.strptime(get_dag_param(key=WILD_CARD_DAG_KEY,
64+
default_value=(datetime.now() - timedelta(days=1)).strftime(
65+
"%Y%m%d*")), "%Y%m%d*")
6266
mongodb_client = MongoClient(config.MONGO_DB_AUTH_URL)
6367
validate_and_update_daily_supra_notice(notice_publication_day=publication_date,
6468
mongodb_client=mongodb_client)

0 commit comments

Comments
 (0)