Airflow Extra Operator Link Not Rendering

Viewed 551

I'm having issues getting extra operator links to render for Airflow.

We have a snippet like this below.

class ExampleLink(BaseOperatorLink):
    def get_link(self, operator, dttm):
        return 'http://example.org'

The issue is that the button is not being rendered in the Airflow UI. I'm currently on v1.10.4, but I can update if that is the issue.

Is anyone familiar with the usage of creating a custom button in the UI?

I am also passing it into the custom operator like below


class ExampleOperator(BaseOperator):
    ui_color = '#e4f0e8'
    operator_extra_link_dict = {
        'Example Console': ExampleLink(),
    }

Any advice or example usage on this is much appreciated.

I also do not see any errors in the logs.

1 Answers

OperatorLink should be defined as follows:

class ExampleLink(BaseOperatorLink):
    name = "example"
    def get_link(self, operator, dttm):
        return 'http://example.org'

The name above will be displayed on the button.

You need to pass the following to your custom class:

class ExampleOperator(BaseOperator):
    ui_color = '#e4f0e8'
    operator_extra_links = [
        ExampleLink(),
    ]

Note: Operator Links only work for the RBAC UI and does not work on old Flask-admin based UI

Related