pabloalcain opened a new issue, #32008:
URL: https://github.com/apache/airflow/issues/32008

   ### What do you see as an issue?
   
   I'm trying to recreate the [Define an operator extra 
link](https://airflow.apache.org/docs/apache-airflow/stable/howto/define-extra-link.html)
 guide, but I cannot get it to work. From the documentation, I understood 
(perhaps incorrectly) that creating this DAG should be enough:
   
   ```python
   from airflow import DAG
   from airflow.models.baseoperator import BaseOperator, BaseOperatorLink
   from airflow.plugins_manager import AirflowPlugin
   from airflow.models.taskinstancekey import TaskInstanceKey
   from airflow.utils.dates import days_ago
   
   class GoogleLink(BaseOperatorLink):
       name = "Google"
   
       def get_link(self, operator: BaseOperator, *, ti_key: TaskInstanceKey):
           return "https://www.google.com";
   
   
   class MyFirstOperator(BaseOperator):
   
       operator_extra_links = (GoogleLink(),)
   
       def __init__(self, **kwargs):
           super().__init__(**kwargs)
   
       def execute(self, context):
           self.log.info("Hello World!")
   
   
   # Defining the plugin class
   class AirflowExtraLinkPlugin(AirflowPlugin):
       name = "extra_link_plugin"
       operator_extra_links = [
           GoogleLink(),
       ]
   
   dag = DAG("extra_link_test", start_date=days_ago(2))
   with dag:
       MyFirstOperator(task_id="my_first_operator")
   ```
   
   but I cannot see the link in the operator, as I expect from the image in the 
documentation
   
![image](https://github.com/apache/airflow/assets/6975120/0d1d5abc-633a-488e-85ac-6b8acd8d7667)
   
   I feel like I'm doing something wrong, maybe related to how I'm registering 
the extra link plugin (is what I'm doing enough?), but I cannot find in the 
documentation how to properly make it work.
   
   ### Solving the problem
   
   I think that having minimal DAG generation in which we can see the operator 
rendered in the UI with the extra link can clarify the situation.
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to