diff --git a/wrenchboard_refreshblog.py b/wrenchboard_refreshblog.py new file mode 100644 index 0000000..04a4986 --- /dev/null +++ b/wrenchboard_refreshblog.py @@ -0,0 +1,47 @@ + +from airflow import DAG +from airflow.operators.dummy import DummyOperator +# from airflow.operators.python import PythonOperator +from airflow.operators.python_operator import PythonOperator +from datetime import datetime, timedelta +from airflow.models import Variable + +import requests + +default_args = { + 'owner': 'WrenchBoard', + 'depends_on_past': False, + 'start_date': datetime(2022, 1, 1), + 'email_on_failure': False, + 'email_on_retry': False, + 'retries': 1 +} + + +def WrenchCronRefreshBlogApi(**kwargs): + url = kwargs["api_host"] + "/v1/refresh-blog" + querystring= {"testuser":"ameye"} + response = requests.request("GET", url, params=querystring) + print(response.text) + +with DAG( + dag_id="WRENCBOARD_CRON_REFRESHBLOG", + default_args=default_args, + start_date=datetime(2024, 9, 1, 10, 00), + schedule_interval=timedelta(minutes=15), + catchup=False) as dag: + t1 = PythonOperator( + task_id = "wrench_cron_refreshblog", + python_callable= WrenchCronRefreshBlogApi, + op_kwargs={ + "api_host" : Variable.get("API_WRENCHBOARD_HOST") + } + ) + + t2 = DummyOperator( + task_id="end" + ) + + t1 >> t2 + +