-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(3145): integrate the provisioner script into Airflow DAGs
- Loading branch information
Showing
3 changed files
with
57 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
from airflow import DAG | ||
from airflow.operators.python_operator import PythonOperator | ||
from datetime import datetime, timedelta | ||
from mark_provisioned import fetch_products_mark_completed | ||
|
||
MONGO_CONN_ID = 'pltsvc-test' | ||
PROV_API_URL = os.getenv('PROD_PROVISIONER_URL') | ||
MARK_PROV_URL = os.getenv('PROD_MARK_PROVISIONED_URL') | ||
|
||
with DAG( | ||
dag_id="provisioner_prod", | ||
schedule_interval='*/7 * * * *', | ||
start_date=datetime.now() - timedelta(minutes=8) | ||
) as dag: | ||
t1 = PythonOperator( | ||
task_id='fetch-products-mark-completed-prod', | ||
python_callable=fetch_products_mark_completed, | ||
op_kwargs={'provisioner_api_url': PROV_API_URL, | ||
'mark_provisioned_url': MARK_PROV_URL, 'mongo_conn_id': MONGO_CONN_ID}, | ||
provide_context=True, | ||
dag=dag | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
from airflow import DAG | ||
from airflow.operators.python_operator import PythonOperator | ||
from datetime import datetime, timedelta | ||
from mark_provisioned import fetch_products_mark_completed | ||
|
||
MONGO_CONN_ID = 'pltsvc-test' | ||
PROV_API_URL = os.getenv('TEST_PROVISIONER_URL') | ||
MARK_PROV_URL = os.getenv('TEST_MARK_PROVISIONED_URL') | ||
|
||
with DAG( | ||
dag_id="provisioner_test", | ||
schedule_interval='*/7 * * * *', | ||
start_date=datetime.now() - timedelta(minutes=8) | ||
) as dag: | ||
t1 = PythonOperator( | ||
task_id='fetch-products-mark-completed-test', | ||
python_callable=fetch_products_mark_completed, | ||
op_kwargs={'provisioner_api_url': PROV_API_URL, | ||
'mark_provisioned_url': MARK_PROV_URL, 'mongo_conn_id': MONGO_CONN_ID}, | ||
provide_context=True, | ||
dag=dag | ||
) |