-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TaskGroup add default_args #16557
TaskGroup add default_args #16557
Conversation
with TaskGroup("group1", default_args={"owner": "group"}): | ||
task_1 = DummyOperator(task_id='task_1') | ||
|
||
assert task_1.owner == 'group' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it would be better to add additional test verifying that setting a parameter on the task level overwrite the default args of the TaskGroup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense, added some test case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs documenting in https://airflow.apache.org/docs/apache-airflow/stable/concepts/dags.html#taskgroups please
@@ -48,6 +49,13 @@ class TaskGroup(TaskMixin): | |||
:type parent_group: TaskGroup | |||
:param dag: The DAG that this TaskGroup belongs to. | |||
:type dag: airflow.models.DAG | |||
:param default_args: A dictionary of default parameters to be used | |||
as constructor keyword parameters when initialising operators. | |||
Note that operators have the same hook, and precede those defined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also add a note here that this will overwrite the default_args
defined in the DAG level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for suggestion, added it
updated the docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! just waiting for the CI to become green
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
Co-authored-by: Xinbin Huang <bin.huangxb@gmail.com>
Confused with CI error, anything need I do to fixed it? |
Some tests (i.e. integration) are flaky and hard to pass all of them sometimes. It's probably fine so I'm merging it. We can revert it if we spot anything unusal later. |
* TaskGroup add default_args * test case && pylint * TaskGroup default_args docs * Update docs/apache-airflow/concepts/dags.rst Co-authored-by: Xinbin Huang <bin.huangxb@gmail.com> Co-authored-by: Xinbin Huang <bin.huangxb@gmail.com>
#13911