Airflow
1.10.5
  • Project
  • License
  • Quick Start
  • Installation
  • Tutorial
  • How-to Guides
    • Setting Configuration Options
    • Initializing a Database Backend
    • Using Operators
    • Managing Connections
    • Securing Connections
    • Rotating encryption keys
    • Writing Logs
    • Celery Executor
    • Dask Executor
    • Scaling Out with Mesos (community contributed)
    • 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
  • Data Profiling
  • Command Line Interface Reference
  • Scheduling & Triggers
  • Plugins
  • Security
  • Time zones
  • REST API Reference
  • Integration
  • Metrics
  • Kubernetes
  • Lineage
  • Changelog
  • FAQ
  • Macros reference
  • Python API Reference
  • Privacy Notice
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(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.

Next Previous

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