From 9677ad114e6909545e90c96a6faba1255ceb0fd2 Mon Sep 17 00:00:00 2001 From: Bas Harenslak Date: Tue, 20 Sep 2022 11:20:45 +0200 Subject: [PATCH 1/2] Clarify owner links doc and fix errors --- docs/apache-airflow/howto/add-owner-links.rst | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/apache-airflow/howto/add-owner-links.rst b/docs/apache-airflow/howto/add-owner-links.rst index 4f6525ff668d0..44f26f7edce42 100644 --- a/docs/apache-airflow/howto/add-owner-links.rst +++ b/docs/apache-airflow/howto/add-owner-links.rst @@ -23,26 +23,27 @@ Add Owner Links to DAG .. versionadded:: 2.4.0 -You can pass the ``owner_link`` parameter for your DAG object, which will make the owner to become a clickable link -in the main DAGs view page. -You can use it to set a custom HTTP link (for example, the owner's Slack channel), or use a -`maitlo `_ link to have an automated email message (up to 500 characters). +You can set the ``owner_links`` argument on your DAG object, which will make the owner a clickable link in the +main DAGs view page instead of a search filter. -Example: -In your DAG file, add a ``owners_link`` parameter to the DAG object that will hold a dictionary of an owner and it's link. -After that, define a task that will use this owner, and the link in the DAGs view will become clickable +Two options are supported: + +* An HTTP link, e.g. to the owner's Slack channel +* A `mailto `_ link which opens your default email client to send an email to the specified address + +In your DAG, set the ``owner_links`` argument specifying a dictionary of an owner (key) and its link (value). +Next define a task using this owner, and the owner in the DAGs view will link to the specified address. .. code-block:: python + :emphasize-lines: 5 - dag = DAG( + with DAG( dag_id="example_dag_owners", - schedule="0 0 * * *", start_date=datetime(2022, 8, 5), - owner_links={"airflow": "https://airflow.apache.org/"}, - ) - - with dag: - bash_task = BashOperator(task_id='task_using_linked_owner', bash_command='echo 1', owner='airflow') + schedule="0 0 * * *", + owner_links={"airflow": "https://airflow.apache.org"}, + ): + BashOperator(task_id="task_using_linked_owner", bash_command="echo 1", owner="airflow") **Screenshot**: From 2ee069856c01478e115baddadd2aa7f327475f9a Mon Sep 17 00:00:00 2001 From: Bas Harenslak Date: Tue, 20 Sep 2022 11:33:21 +0200 Subject: [PATCH 2/2] Add examples --- docs/apache-airflow/howto/add-owner-links.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/apache-airflow/howto/add-owner-links.rst b/docs/apache-airflow/howto/add-owner-links.rst index 44f26f7edce42..8c18ca5fd2f06 100644 --- a/docs/apache-airflow/howto/add-owner-links.rst +++ b/docs/apache-airflow/howto/add-owner-links.rst @@ -28,8 +28,8 @@ main DAGs view page instead of a search filter. Two options are supported: -* An HTTP link, e.g. to the owner's Slack channel -* A `mailto `_ link which opens your default email client to send an email to the specified address +* An HTTP link (e.g. ``https://www.example.com``) which opens the webpage in your default internet client +* A `mailto `_ link (e.g. ``mailto:example@airflow.com``) which opens your default email client to send an email to the specified address In your DAG, set the ``owner_links`` argument specifying a dictionary of an owner (key) and its link (value). Next define a task using this owner, and the owner in the DAGs view will link to the specified address.