zach-overflow commented on code in PR #70343:
URL: https://github.com/apache/airflow/pull/70343#discussion_r3724303709


##########
task-sdk/src/airflow/sdk/bases/operatorlink.py:
##########
@@ -44,6 +44,24 @@ class BaseOperatorLink(metaclass=ABCMeta):
     def name(self) -> str:
         """Name of the link. This will be the button name on the task UI."""
 
+    @property
+    def static_url(self) -> str | None:
+        """
+        An optional static URL for this operator link.
+
+        If this returns a non-None value, it is used as the link URL directly,
+        without reading from XCom. This avoids unnecessary metadata database 
writes
+        and reads for links whose URL is constant across all task instances
+        (e.g. a link to the operator's documentation page).
+
+        Override this in subclasses where the link URL does not vary per task 
instance.
+        When ``static_url`` is set, there is no need to implement 
:meth:`get_link`
+        or push anything to XCom during task execution.
+
+        :return: A static URL string, or ``None`` to use the XCom-based 
:meth:`get_link`.
+        """

Review Comment:
   It might be a good idea to add this informatio to the [relevant site 
doc](https://github.com/apache/airflow/blob/main/airflow-core/docs/howto/define-extra-link.rst)
 too.



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