Airflow
stable
  • 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
    • Scaling Out with Celery
    • Scaling Out with Dask
    • 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
  • UI / Screenshots
  • Concepts
  • Data Profiling
  • Command Line Interface
  • Scheduling & Triggers
  • Plugins
  • Security
  • Time zones
  • Experimental Rest API
  • Integration
  • Metrics
  • Kubernetes
  • Lineage
  • Changelog
  • FAQ
  • Macros reference
  • API Reference
Airflow
  • Docs »
  • How-to Guides »
  • Define an operator extra link
  • Edit on GitHub

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

Revision a1828391.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: stable
Versions
latest
stable
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.