Skip to content

Commit

Permalink
Small changes on "DAGs and Tasks documentation" (apache#14853)
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierLopezT authored May 9, 2021
1 parent 350fd62 commit 00336ad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
9 changes: 6 additions & 3 deletions airflow/example_dags/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,21 @@
# [END basic_task]

# [START documentation]
dag.doc_md = __doc__

t1.doc_md = dedent(
"""\
#### Task Documentation
You can document your task using the attributes `doc_md` (markdown),
`doc` (plain text), `doc_rst`, `doc_json`, `doc_yaml` which gets
rendered in the UI's Task Instance Details page.
![img](http://montcs.bloomu.edu/~bobmon/Semesters/2012-01/491/import%20soul.png)
"""
)

dag.doc_md = __doc__ # providing that you have a docstring at the beggining of the DAG
dag.doc_md = """
This is a documentation placed anywhere
""" # otherwise, type it like this
# [END documentation]

# [START jinja_template]
Expand Down
Binary file added docs/apache-airflow/img/dag_doc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/apache-airflow/img/task_doc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion docs/apache-airflow/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,19 @@ Adding DAG and Tasks documentation
----------------------------------
We can add documentation for DAG or each single task. DAG documentation only support
markdown so far and task documentation support plain text, markdown, reStructuredText,
json, yaml.
json, yaml. The DAG documentation can be written as a doc string at the beginning of the DAG file (recommended)
or anywhere in the file. Below you can find some examples on how to implement task and DAG docs,
as well as screenshots:

.. exampleinclude:: /../../airflow/example_dags/tutorial.py
:language: python
:dedent: 4
:start-after: [START documentation]
:end-before: [END documentation]

.. image:: img/task_doc.png
.. image:: img/dag_doc.png

Setting up Dependencies
-----------------------
We have tasks ``t1``, ``t2`` and ``t3`` that do not depend on each other. Here's a few ways
Expand Down

0 comments on commit 00336ad

Please sign in to comment.