potiuk commented on issue #40196:
URL: https://github.com/apache/airflow/issues/40196#issuecomment-2225290546

   > So @potiuk , you're saying that task_group should not return a task?
   
   No. What I am saying is that task_group should not return anything (i.e. 
None) and IMHO returning task should be deprecated and raise warning (@uranusjr 
-> would love to hear what you think and if I understood the whole problem 
properly).
   
   We already have code implemented in #20671 by @uranusjr that will act as-if 
the function returned the `task_group` itself - in case `@task_group`-decorated 
group returns None. And this is is "reasonable" behaviour IMHO. - because it 
will properly model dependencies (both when something depends on tg and when tg 
depends on something else).
   
   Returning a single task from `task_group` decorated method IMHO is just 
confusing (as you yourself noticed) - because if you return a single task, then 
it is impossible to serve both sides of the dependencies. you can only handle 
`a >> tg` (if you return first tasl of a group) or `tg >> b` (if you return 
last task of the group) but not both. This is because these two dependencies 
require different tasks belonging to the same group to be used as dependency.
   
   Of course if you return `[ first_task, last_task]` from task_group this will 
also work, and that should still be allowed - but this is really uninituitive 
and unexpected, so this should be treated as an obscure, while valid, approach 
that allows some more sophisticated cases, including `[task, task]` if you 
**really** want to do exactly what currently returning task does and avoid the 
warning.
   
   Does it make sense? 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to