Support setting dependencies for tasks called outside TaskGroup context manager#32351
Merged
Merged
Conversation
50a8ca9 to
001b8ae
Compare
uranusjr
reviewed
Jul 5, 2023
uranusjr
reviewed
Jul 5, 2023
3b00407 to
8b129b4
Compare
uranusjr
reviewed
Jul 11, 2023
uranusjr
reviewed
Jul 11, 2023
d4d402a to
ac2aa9e
Compare
uranusjr
reviewed
Jul 13, 2023
uranusjr
reviewed
Jul 13, 2023
uranusjr
reviewed
Jul 13, 2023
88759ef to
ec2a74c
Compare
uranusjr
reviewed
Jul 14, 2023
uranusjr
approved these changes
Jul 14, 2023
…xt manager
Currently, you must instantiate a classic operator or call a decorated
operator inside the context manager before it will link up with the context manager.
For example, tasks 1 and 2 below will be outside the group1 context:
```
task1 = BashOperator(task_id="task1", bash_command="echo task1")
task2 = BashOperator(task_id="task2", bash_command="echo task2")
with TaskGroup('group1'):
task1 >> task2
```
This PR addresses the above such that when you do that, the tasks will
be inside the group1 context.
For a single task, you can do:
```
task1 = BashOperator(task_id="task1", bash_command="echo task1")
with TaskGroup('group1') as scope:
scope.add(task1)
```
40c843b to
92dcac3
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, you must instantiate a classic operator or call a decorated operator inside the context manager before it will link up with the context manager. For example, tasks 1 and 2 below will be outside the group1 context:
This PR addresses the above such that when you do that, the tasks will be inside the group1 context.
For a single task, you can do: