-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
Changes from all commits
9073f69
294ffcd
619c03d
a1a3260
17a8e4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -823,6 +823,27 @@ def section_2(value): | |
assert extract_node_id(task_group_to_dict(dag.task_group)) == node_ids | ||
|
||
|
||
def test_default_args(): | ||
"""Testing TaskGroup with default_args""" | ||
|
||
execution_date = pendulum.parse("20201109") | ||
with DAG( | ||
dag_id='example_task_group_default_args', | ||
start_date=execution_date, | ||
default_args={ | ||
"owner": "dag", | ||
}, | ||
): | ||
with TaskGroup("group1", default_args={"owner": "group"}): | ||
task_1 = DummyOperator(task_id='task_1') | ||
task_2 = DummyOperator(task_id='task_2', owner='task') | ||
task_3 = DummyOperator(task_id='task_3', default_args={"owner": "task"}) | ||
|
||
assert task_1.owner == 'group' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. make sense, added some test case |
||
assert task_2.owner == 'task' | ||
assert task_3.owner == 'task' | ||
|
||
|
||
def test_duplicate_task_group_id(): | ||
"""Testing automatic suffix assignment for duplicate group_id""" | ||
|
||
|
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