I'm obviously in favour of the way the AIP was written, and that's for two
primary reasons.
1. It's analogous to setup and teardown in testing frameworks where you don't
ever explicitly call them - the framework handles it for you.
2. `task1 >> task2 >> teardown_task` to me falsely implies that teardown
depends on task2, But it doesn't. It only depends on the "scope being exited".
And as for the Zen of Python point: python itself doesn't even follow them
well. There are three ways of formatting strings in python.
On thinking a bit more about it, I think I have a counter point to where I
think explicit dependencies lead to a false expectation:
```
with TaskGroup("tg1"):
task1 ≥≥ teardown_task
task2 >> task3 >> task4 >> task5
```
Does teardown run as soon as task 1 is finished, or when all of task1 and task5
are finished?
I very strongly believe that teardown should only run at the end of a TaskGroup
- a hard rule on this makes it easier for users to reason about and understand
it. If it's only as a result of it's explicit dependencies then it means users
have to reason about when each teardown task is run in each situation as it
might be different from dag to dag.
In this case the teardown is akin to a "finally" block in python, and the
TaskGroup is the "try" block, which I hope is a concept that almost everyone
writing DAGs will understand and be able to relate too.
Teardown tasks are already special in a number of ways (clearing behaviour,
special failure rules for resulting dag run, different trigger rule) so users
need to know how it works.
So I vote for keeping it implicit only, but if we as a community favour
explicit only then we need to have an enforced requirement that there only
leaves of a TG can be teardown (if they are in use) -- i.e. `[taak1, task5] >>
teardown_task` would be required in this case.
(And a similar role for set up. If there are any, the only root tasks in a TG
must be set up)
Ash
On 23 March 2023 22:16:42 GMT, Pierre Jeambrun <[email protected]> wrote:
>I am also in favor of explicit relationships only.
>
>From a person who didn't work on AIP-52, it seems easier to understand what
>is going on without having to dive into the setup/teardown documentation.
>
>Le jeu. 23 mars 2023 à 22:53, Jed Cunningham <[email protected]> a
>écrit :
>
>> I've been working closely with Daniel on AIP-52 for a while now, but I'll
>> still share my thoughts here.
>>
>> I'm also in favor of only supporting explicit relationships.
>>
>> In my opinion, even if multiple setup/teardown per scope never materialize,
>> explicit relationships are still a better choice due to the clarity it
>> brings today.
>>