Created
May 18, 2020 18:20
-
-
Save sairamkrish/0866524c00cb5fb2b341da4c2ebbebfd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
''' | |
### DAG Creator | |
This workflow listens for Triggers. Based on config parameters passed., It creates DAG. | |
''' | |
from datetime import timedelta, datetime | |
from airflow import DAG | |
from airflow.utils.dates import days_ago | |
from operators.rest_to_template_wrapper_operator import RestToTemplateWrapperOperator | |
# These args will get passed on to each operator | |
# You can override them on a per-task basis during operator initialization | |
default_args = { | |
'schedule_interval': None, # exclusively “externally triggered” DAG | |
'start_date': days_ago(2), | |
'catchup': False, | |
'owner': 'admin', | |
} | |
dag = DAG( | |
'dag-creator', | |
default_args=default_args, | |
description='An exclusive workflow for creating another workflow', | |
) | |
t1 = RestToTemplateWrapperOperator(task_id="generate-dag", dag=dag, provide_context=True) | |
dag.doc_md = __doc__ | |
t1.doc_md = """\ | |
#### Generate dag | |
This action generates a DAG workflow. | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment