Created
June 6, 2022 00:50
-
-
Save Pierian-Data/4d98dcec985a74b0b7c4f76278fdd90c to your computer and use it in GitHub Desktop.
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
import datetime | |
from airflow import models | |
from airflow.operators import bash | |
# If you are running Airflow in more than one time zone | |
# see https://airflow.apache.org/docs/apache-airflow/stable/timezone.html | |
# for best practices | |
YESTERDAY = datetime.datetime.now() - datetime.timedelta(days=1) | |
default_args = { | |
'owner': 'Composer Example', | |
'depends_on_past': False, | |
'email': [''], | |
'email_on_failure': False, | |
'email_on_retry': False, | |
'retries': 1, | |
'retry_delay': datetime.timedelta(minutes=5), | |
'start_date': YESTERDAY, | |
} | |
with models.DAG( | |
'composer_quickstart', | |
catchup=False, | |
default_args=default_args, | |
schedule_interval=datetime.timedelta(days=1)) as dag: | |
# Print the dag_run id from the Airflow logs | |
print_dag_run_conf = bash.BashOperator( | |
task_id='print_dag_run_conf', bash_command='echo {{ dag_run.id }}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment