brentsifi opened a new issue, #43757: URL: https://github.com/apache/airflow/issues/43757
### Apache Airflow version 2.10.2 ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? Extra external links are not appearing on mapped tasks. ### What you think should happen instead? While I am able to add extra external links to an existing operator (the `PythonOperator` in this case) and able to view them in the UI, I am not able see the extra links when using mapped tasks of the same operator. In this screenshot, I have a non-mapped task version of a simple DAG using the `PythonOperator` and the extra external link button is visible.  In this screenshot, I have a mapped task version of the same DAG using the `PythonOperator` and the extra external link is not visible.  ### How to reproduce Create a new directory and run `astro dev init`. Create a file named `my_extra_link_plugin.py` with the following code and add it to the `plugins` folder: ``` from airflow.models.baseoperator import BaseOperator from airflow.models.baseoperator import BaseOperatorLink from airflow.models.taskinstancekey import TaskInstanceKey from airflow.operators.python import PythonOperator from airflow.plugins_manager import AirflowPlugin # define the extra link class PythonDocsLink(BaseOperatorLink): # name the link button in the UI name = "Python Docs" # add the button to one or more operators operators = [PythonOperator] # provide the link def get_link(self, operator: BaseOperator, *, ti_key: TaskInstanceKey): return "https://docs.python.org/3/" # define the plugin class class AirflowExtraLinkPlugin(AirflowPlugin): name = "extra_link_plugin" operator_extra_links = [ PythonDocsLink(), ] ``` In the `dags` folder, create a file named `add.py` that contains the following: ``` from pendulum import datetime from airflow.models.dag import DAG from airflow.operators.python import PythonOperator with DAG( dag_id="add", schedule=None, start_date=datetime(2024, 11, 3), catchup=False, ) as dag: def add_function(x: int, y: int): return x + y added_values = PythonOperator( task_id="add", python_callable=add_function, op_kwargs={"x": 7, "y": 10}, ) ``` In the `dags` folder, create a file named `add_mapped_task.py` that contains the following: ``` from pendulum import datetime from airflow.models.dag import DAG from airflow.operators.python import PythonOperator with DAG( dag_id="add_with_mapped_tasks", schedule=None, start_date=datetime(2024, 11, 3), catchup=False, ) as dag: def add_function(x: int, y: int): return x + y added_values = PythonOperator.partial( task_id="add", python_callable=add_function, op_kwargs={"y": 10}, # optionally, you can set a custom index to display in the UI (Airflow 2.9+) map_index_template="Input x={{ task.op_args[0] }}", ).expand(op_args=[[1], [2], [3]]) ``` Trigger both DAGs and click on the Details tab. ### Operating System Sonoma 14.7 ### Versions of Apache Airflow Providers _No response_ ### Deployment Astronomer ### Deployment details Using Astronomer Runtime 12.2.0 ### Anything else? _No response_ ### Are you willing to submit PR? - [ ] 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]
