feng-tao commented on a change in pull request #5059: [AIRFLOW-161] New
redirect route and extra links
URL: https://github.com/apache/airflow/pull/5059#discussion_r274757460
##########
File path: airflow/models/baseoperator.py
##########
@@ -941,3 +945,34 @@ def xcom_pull(
task_ids=task_ids,
dag_id=dag_id,
include_prior_dates=include_prior_dates)
+
+ @property
+ def extra_links(self):
+ # type: () -> Iterable[str]
+ return list(self.operator_extra_link_dict.keys())
+
+ def get_extra_links(self, dttm, link_name):
+ """
+ For an operator, gets the URL that the external links specified in
+ `extra_links` should point to.
+ :raise ValueError: The error message of a ValueError will be passed on
through to
+ the fronted to show up as a tooltip on the disabled link
+ :param dttm: The datetime parsed execution date for the URL being
searched for
+ :param link_name: The name of the link we're looking for the URL for.
Should be
+ one of the options specified in `extra_links`
+ :return: A URL
+ """
+ if link_name in self.operator_extra_link_dict:
+ return self.operator_extra_link_dict[link_name].get_link(self,
dttm)
+
+
+class BaseOperatorLink:
+ """
+ Abstract base class that defines how we get an operator link.
+ """
+
+ __metaclass__ = ABCMeta
Review comment:
is this compatible in both py2 and py3 ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services