Airflow
1.10.4
  • Project
  • License
  • Quick Start
  • Installation
  • Tutorial
  • How-to Guides
    • Add a new role in RBAC UI
    • Setting Configuration Options
    • Initializing a Database Backend
    • Using Operators
    • Managing Connections
    • Securing Connections
    • Rotating encryption keys
    • Writing Logs
    • Running Airflow behind a reverse proxy
    • Running Airflow with systemd
    • Running Airflow with upstart
    • Using the Test Mode Configuration
    • Checking Airflow Health Status
    • Define an operator extra link
    • Tracking User Activity
  • UI / Screenshots
  • Concepts
  • Scheduling & Triggers
  • Executor
  • Plugins
  • Security
  • Time zones
  • Using the CLI
  • Integration
  • Metrics
  • Kubernetes
  • Lineage
  • Changelog
  • FAQ

References

  • CLI
  • Macros
  • Python API
  • REST API
Airflow
  • Docs »
  • How-to Guides »
  • Define an operator extra link
  • View page source

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:

../_images/operator_extra_link.png

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().__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.

Next Previous

Built with Sphinx using a theme provided by Read the Docs.