ytoprakc commented on code in PR #67207:
URL: https://github.com/apache/airflow/pull/67207#discussion_r3313704010
##########
task-sdk/src/airflow/sdk/definitions/decorators/task_group.py:
##########
@@ -94,8 +94,11 @@ def __call__(self, *args: FParams.args, **kwargs:
FParams.kwargs) -> DAGNode:
def _create_task_group(self, tg_factory: Callable[..., TaskGroup], *args:
Any, **kwargs: Any) -> DAGNode:
with tg_factory(add_suffix_on_collision=True, **self.tg_kwargs) as
task_group:
- if self.function.__doc__ and not task_group.tooltip:
- task_group.tooltip = self.function.__doc__
+ if self.function.__doc__:
+ if not task_group.tooltip:
+ task_group.tooltip = self.function.__doc__
+ if not task_group.doc_md:
+ task_group.doc_md = inspect.cleandoc(self.function.__doc__)
Review Comment:
I changed this to use one rule consistently. The decorator now takes the
function docstring once and assigns the same raw docstring value to both
`tooltip` and `doc_md`.
For `doc_md`, markdown indentation normalisation now happens later in the
API response model via the `GridNodeResponse` field validator, matching the Dag
response pattern.
I also handled the `.md` edge case for the decorator fallback. When `doc_md`
is populated from a decorated function docstring, it is treated as literal
documentation text and does not go through the attrs file path converter.
Explicit `doc_md` values ending in `.md` still keep the existing file
resolution behaviour.
--
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]