ashb commented on a change in pull request #5743: [AIRFLOW-5088][AIP-24] Persisting serialized DAG in DB for webserver scalability URL: https://github.com/apache/airflow/pull/5743#discussion_r333397306
########## File path: docs/howto/define_extra_link.rst ########## @@ -56,3 +56,27 @@ The following code shows how to add extra links to an operator: You can also add a global operator extra link that will be available to all the operators through airflow plugin. Learn more about it in the :ref:`plugin example <plugin-example>`. + +With DAG Serialization +---------------------- + +If :ref:`DAG Serialization <enable-dag-serialization>` is turned on Operator +extra links have to be **also** defined and registered in +plugins (apart from the code in Operator definition) to work. + +``plugins/extra_link.py``: + +.. code-block:: python + + from airflow.plugins_manager import AirflowPlugin + from airflow.models.baseoperator import BaseOperatorLink + + class GoogleLink(BaseOperatorLink): + + def get_link(self, operator, dttm): + return "https://www.google.com" + + # Defining the plugin class + class AirflowExtraLinkPlugin(AirflowPlugin): + name = "extra_link_plugin" + serialized_operator_extra_links = [GoogleLink(), ] Review comment: It's slightly odd that this is an instance here, rather than just a class. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
