-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persist DAG and task doc values in TaskFlow API if explicitly set #29399
Conversation
if self.function.__doc__: | ||
op_doc_attrs = [op.doc, op.doc_json, op.doc_md, op.doc_rst, op.doc_yaml] | ||
# Set the task's doc_md to the function's docstring if it exists and no other doc* args are set. | ||
if self.function.__doc__ and not any(op_doc_attrs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking against all of the doc attrs for tasks rather than just doc_md
. Thinking users most likely wouldn't set more than one of these at a time.
@@ -2565,58 +2565,49 @@ def noop_pipeline(): | |||
|
|||
dag = noop_pipeline() | |||
assert isinstance(dag, DAG) | |||
assert dag.dag_id, "noop_pipeline" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typical example of improper assertion that is being fixed in this PR.
|
||
task | ||
@dag_decorator( | ||
"test-dag", start_date=DEFAULT_DATE, template_searchpath=template_dir, doc_md=template_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was broken even after correcting the assertion. Just needed a proper template_searchpath
arg.
86962df
to
23ceb45
Compare
If users set `doc_md` arg on `@dag`- or `@task`-decorated TaskFlow functions and those functions have a docstring, the `doc_md` value is not respected. Instead this PR will enforce only using the TaskFlow function docstring as the documentation if `doc_md` (or any `doc*` attrs for tasks) is not set.
23ceb45
to
0eb2c5e
Compare
…9399) If users set `doc_md` arg on `@dag`- or `@task`-decorated TaskFlow functions and those functions have a docstring, the `doc_md` value is not respected. Instead this PR will enforce only using the TaskFlow function docstring as the documentation if `doc_md` (or any `doc*` attrs for tasks) is not set. (cherry picked from commit e02bfc8)
…9399) If users set `doc_md` arg on `@dag`- or `@task`-decorated TaskFlow functions and those functions have a docstring, the `doc_md` value is not respected. Instead this PR will enforce only using the TaskFlow function docstring as the documentation if `doc_md` (or any `doc*` attrs for tasks) is not set. (cherry picked from commit e02bfc8)
If users set
doc_md
arg on@dag
- or@task
-decorated TaskFlow functions and those functions have a docstring, thedoc_md
value is not respected. Instead this PR will enforce only using the TaskFlow function docstring as the documentation ifdoc_md
(or anydoc*
attrs for tasks) is not set.P.S. There were a number of DAG decorator tests that had improper assertions. Those have been fixed in this PR as well.