Define an operator extra linkΒΆ
For each operator, you can define its own extra links that can redirect users to external systems. The extra link buttons will be available on the task page:
The following code shows how to add extra links to an operator:
from airflow.models.baseoperator import BaseOperator, BaseOperatorLink
from airflow.utils.decorators import apply_defaults
class GoogleLink(BaseOperatorLink):
def get_link(self, operator, dttm):
return "https://www.google.com"
class MyFirstOperator(BaseOperator):
operator_extra_link_dict = {
"Google": GoogleLink(),
}
@apply_defaults
def __init__(self, *args, **kwargs):
super(MyFirstOperator, self).__init__(*args, **kwargs)
def execute(self, context):
self.log.info("Hello World!")
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 plugin example.