fredthomsen commented on issue #40196:
URL: https://github.com/apache/airflow/issues/40196#issuecomment-2212316917
Glad I found this issue as I was experiencing the same with the following:
```
from typing import Any
from airflow.decorators import dag, task, task_group
@dag()
def test_dag() -> None:
@task
def init_data() -> dict[str, Any]:
return {"some": "data"}
@task
def something_important(data: dict[str, Any]) -> None: ...
@task_group
def transform_data(data: dict[str, Any]) -> dict[str, Any]:
@task
def must_read_data_before_touch(data: dict[str, Any]) -> dict[str,
Any]:
_ = data["some"]
return data
@task
def touch_data(data: dict[str, Any]) -> dict[str, Any]:
data["new"] = "info"
return data
return touch_data(must_read_data_before_touch(data))
data = init_data()
no_data = something_important(data)
new_data = transform_data(data)
no_data >> new_data
test_dag()
```
Now I had trouble finding this behavior explained in documentation as well,
and I have definitely made heavy use of `task_group`s returning values, but
looking now I can see that `_TaskGroupFactory.__call__` does explain this
behavior in it's docstring and some inline comments clarify things further in
`_TaskGroupFactory._create_task_group`. The behavior makes sense and yet is
unexpected at first glace.
--
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]