From a06a53c9351ca97927822c6f16e55241fe5ec2ad Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 9 Sep 2024 09:24:00 -0400 Subject: [PATCH] nw dags --- wrenchboard_interestcount.py | 47 ++++++++++++++++++++++++++++++++ wrenchboard_livenotifications.py | 47 ++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 wrenchboard_interestcount.py create mode 100644 wrenchboard_livenotifications.py diff --git a/wrenchboard_interestcount.py b/wrenchboard_interestcount.py new file mode 100644 index 0000000..e7a4d4a --- /dev/null +++ b/wrenchboard_interestcount.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 WrenchCronApproveReminderApi(**kwargs): + url = kwargs["api_host"] + "/v1/interestcount" + querystring= {"testuser":"ameye"} + response = requests.request("GET", url, params=querystring) + print(response.text) + +with DAG( + dag_id="WRENCBOARD_CRON_INTERESTCOUNT", + default_args=default_args, + start_date=datetime(2024, 9, 1, 10, 00), + schedule_interval=timedelta(minutes=2), + catchup=False) as dag: + t1 = PythonOperator( + task_id = "wrenchboard_interestcount", + python_callable= WrenchCronApproveReminderApi, + op_kwargs={ + "api_host" : Variable.get("API_WRENCHBOARD_HOST") + } + ) + + t2 = DummyOperator( + task_id="end" + ) + + t1 >> t2 + + diff --git a/wrenchboard_livenotifications.py b/wrenchboard_livenotifications.py new file mode 100644 index 0000000..9eed7dd --- /dev/null +++ b/wrenchboard_livenotifications.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 WrenchCronNotificationsApi(**kwargs): + url = kwargs["api_host"] + "/v1/notifications" + querystring= {"testuser":"ameye"} + response = requests.request("GET", url, params=querystring) + print(response.text) + +with DAG( + dag_id="WRENCBOARD_LIVE_NOTIFICATIONS", + default_args=default_args, + start_date=datetime(2024, 9, 1, 10, 00), + schedule_interval=timedelta(minutes=300), + catchup=False) as dag: + t1 = PythonOperator( + task_id = "wrenchboard_livenotifications", + python_callable= WrenchCronNotificationsApi, + op_kwargs={ + "api_host" : Variable.get("API_WRENCHBOARD_HOST") + } + ) + + t2 = DummyOperator( + task_id="end" + ) + + t1 >> t2 + +