jscheffl commented on PR #38021:
URL: https://github.com/apache/airflow/pull/38021#issuecomment-2002629839
> One issue with this is (IIUC) that it assumes that groups won't overlap.
But logs for a TI can come from multiple sources and this might not always be
true. First it was only worker. Then we added triggerer. Then we added
scheduler (in exceptional circumstances). Now there is interest in logging to
TI logs any action specific to a TI. (e.g. scheduler state changes). With
AIP-44, there could be logs from webserver / internal API server. To the extent
that these groups can overlap in time, the folding will be misleading.
Yes, agree - partly. Groups can overlap. And if you have a large codebase
you need to be careful. But you are not focred to use grouping in your custom
code of tasks. I hope I took care in the case in pre/post execution that I
catched all cases. If you thing explicitly I missed any let me know. Happy to
add a patch/bugfix.
As of your concerns I just added an explicit check which I did not do
before... what happens if you nest groups...?!?
Experiment with group nesting:
```
print("before")
print("::group::Outer Group")
print("within 1")
print("::group::Inner Group 1")
print("within 2a - inside a second group")
print("::endgroup::")
print("within 2b")
print("::group::Inner Group 2")
print("within 2c - inside a second group")
print("::endgroup::")
print("within 3")
print("::endgroup::")
print("after")
```
Result: Seems to work. Nested groups allow nested folding:

If the numbers of group starts and ends do not match logs might look
"weired". I'd assume if more groups are opened than ended still you can
un-fold. Too many group ends will not be a problem. If group starts and ends
are completely mixed the context might look strange but in general I'd assume
all logs should be at least un-foldable by the user.
If you for example take this bad usage:
```
print("before")
print("::group::Group 1 forgot to end")
print("within 1")
print("::group::Group 2 forgot to end")
print("within 2")
print("::group::Group 3 forgot to end")
print("within 3")
print("after")
```
Result will render a folding group to the end of logs "eating up" other
groups:

...but still it is possible to un-fold all:

--
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]