-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up
default_args
usage in docs (#19803)
This PR aligns `default_args` usage within docs to updates that have been made to example DAGs across the board. The main types of updates include: - Removing `start_date` from being declared in `default_args`. - Removing the pattern of declaring `default_args` separately from the `DAG()` object. - Updating `default_args` values to more relevant examples. - Replace `DummyOperator` with another operator to make some other `default_args` updates relevant and applicable.
- Loading branch information
Showing
11 changed files
with
78 additions
and
82 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 |
---|---|---|
|
@@ -34,37 +34,34 @@ | |
|
||
# [END import_module] | ||
|
||
# [START default_args] | ||
# These args will get passed on to each operator | ||
# You can override them on a per-task basis during operator initialization | ||
default_args = { | ||
'owner': 'airflow', | ||
'depends_on_past': False, | ||
'email': ['[email protected]'], | ||
'email_on_failure': False, | ||
'email_on_retry': False, | ||
'retries': 1, | ||
'retry_delay': timedelta(minutes=5), | ||
# 'queue': 'bash_queue', | ||
# 'pool': 'backfill', | ||
# 'priority_weight': 10, | ||
# 'end_date': datetime(2016, 1, 1), | ||
# 'wait_for_downstream': False, | ||
# 'dag': dag, | ||
# 'sla': timedelta(hours=2), | ||
# 'execution_timeout': timedelta(seconds=300), | ||
# 'on_failure_callback': some_function, | ||
# 'on_success_callback': some_other_function, | ||
# 'on_retry_callback': another_function, | ||
# 'sla_miss_callback': yet_another_function, | ||
# 'trigger_rule': 'all_success' | ||
} | ||
# [END default_args] | ||
|
||
# [START instantiate_dag] | ||
with DAG( | ||
'tutorial', | ||
default_args=default_args, | ||
# [START default_args] | ||
# These args will get passed on to each operator | ||
# You can override them on a per-task basis during operator initialization | ||
default_args={ | ||
'depends_on_past': False, | ||
'email': ['[email protected]'], | ||
'email_on_failure': False, | ||
'email_on_retry': False, | ||
'retries': 1, | ||
'retry_delay': timedelta(minutes=5), | ||
# 'queue': 'bash_queue', | ||
# 'pool': 'backfill', | ||
# 'priority_weight': 10, | ||
# 'end_date': datetime(2016, 1, 1), | ||
# 'wait_for_downstream': False, | ||
# 'sla': timedelta(hours=2), | ||
# 'execution_timeout': timedelta(seconds=300), | ||
# 'on_failure_callback': some_function, | ||
# 'on_success_callback': some_other_function, | ||
# 'on_retry_callback': another_function, | ||
# 'sla_miss_callback': yet_another_function, | ||
# 'trigger_rule': 'all_success' | ||
}, | ||
# [END default_args] | ||
description='A simple tutorial DAG', | ||
schedule_interval=timedelta(days=1), | ||
start_date=datetime(2021, 1, 1), | ||
|
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
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
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 |
---|---|---|
|
@@ -114,19 +114,13 @@ in the configuration file. When turned off, the scheduler creates a DAG run only | |
from datetime import datetime, timedelta | ||
default_args = { | ||
"owner": "airflow", | ||
"depends_on_past": False, | ||
"email": ["[email protected]"], | ||
"email_on_failure": False, | ||
"email_on_retry": False, | ||
"retries": 1, | ||
"retry_delay": timedelta(minutes=5), | ||
} | ||
dag = DAG( | ||
"tutorial", | ||
default_args=default_args, | ||
default_args={ | ||
"depends_on_past": True, | ||
"retries": 1, | ||
"retry_delay": timedelta(minutes=3), | ||
}, | ||
start_date=datetime(2015, 12, 1), | ||
description="A simple tutorial DAG", | ||
schedule_interval="@daily", | ||
|
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
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