Skip to content
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

Merged
merged 5 commits into from
Jun 23, 2021
Merged

TaskGroup add default_args #16557

merged 5 commits into from
Jun 23, 2021

Conversation

penggongkui
Copy link
Contributor

with TaskGroup("group1", default_args={"owner": "group"}):
task_1 = DummyOperator(task_id='task_1')

assert task_1.owner == 'group'
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -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
Copy link
Contributor

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?

Copy link
Contributor Author

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

@penggongkui
Copy link
Contributor Author

Needs documenting in https://airflow.apache.org/docs/apache-airflow/stable/concepts/dags.html#taskgroups please

updated the docs

Copy link
Contributor

@xinbinhuang xinbinhuang left a 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

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Jun 22, 2021
@github-actions
Copy link

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>
@penggongkui
Copy link
Contributor Author

Confused with CI error, anything need I do to fixed it?

@xinbinhuang xinbinhuang merged commit c8d0b0e into apache:main Jun 23, 2021
@xinbinhuang
Copy link
Contributor

xinbinhuang commented Jun 23, 2021

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.

Jorricks pushed a commit to Jorricks/airflow that referenced this pull request Jun 24, 2021
* 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>
@kaxil kaxil added this to the Airflow 2.2 milestone Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full tests needed We need to run full set of tests for this PR to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants