You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/01/15 12:22:06 UTC

[airflow] branch master updated: Update docs to register Operator Extra Links (#13683)

This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d21082  Update docs to register Operator Extra Links (#13683)
3d21082 is described below

commit 3d21082adc3bde63a15dad4db85b448ff695cfc6
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Fri Jan 15 12:21:53 2021 +0000

    Update docs to register Operator Extra Links (#13683)
    
    
    closes https://github.com/apache/airflow/issues/13659
    
    * Update docs/apache-airflow/howto/define_extra_link.rst
    
    Co-authored-by: Jarek Potiuk <ja...@potiuk.com>
    
    Co-authored-by: Jarek Potiuk <ja...@potiuk.com>
---
 docs/apache-airflow/howto/define_extra_link.rst | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/docs/apache-airflow/howto/define_extra_link.rst b/docs/apache-airflow/howto/define_extra_link.rst
index d9277ae..374f69e 100644
--- a/docs/apache-airflow/howto/define_extra_link.rst
+++ b/docs/apache-airflow/howto/define_extra_link.rst
@@ -27,11 +27,12 @@ will be available on the task page:
 
 .. image:: ../img/operator_extra_link.png
 
-The following code shows how to add extra links to an operator:
+The following code shows how to add extra links to an operator via Plugins:
 
 .. code-block:: python
 
     from airflow.models.baseoperator import BaseOperator, BaseOperatorLink
+    from airflow.plugins_manager import AirflowPlugin
     from airflow.utils.decorators import apply_defaults
 
 
@@ -54,6 +55,13 @@ The following code shows how to add extra links to an operator:
         def execute(self, context):
             self.log.info("Hello World!")
 
+    # Defining the plugin class
+    class AirflowExtraLinkPlugin(AirflowPlugin):
+        name = "extra_link_plugin"
+        operator_extra_links = [GoogleLink(), ]
+
+.. note:: Operator Extra Links should be registered via Airflow Plugins or custom Airflow Provider to work.
+
 You can also add a global operator extra link that will be available to
 all the operators through an airflow plugin or through airflow providers. You can learn more about it in the
 :ref:`plugin example <plugin-example>` and in :doc:`apache-airflow-providers:index`.