This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 4c878798ef Sort extra_links for predictable order in UI. (#32762)
4c878798ef is described below

commit 4c878798ef88a1fa45956163630d71b6fc4f401f
Author: Karthikeyan Singaravelan <[email protected]>
AuthorDate: Sat Jul 22 15:54:03 2023 +0530

    Sort extra_links for predictable order in UI. (#32762)
---
 airflow/models/abstractoperator.py            | 2 +-
 tests/serialization/test_dag_serialization.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/airflow/models/abstractoperator.py 
b/airflow/models/abstractoperator.py
index 0c6d89fff3..97e3941f0f 100644
--- a/airflow/models/abstractoperator.py
+++ b/airflow/models/abstractoperator.py
@@ -469,7 +469,7 @@ class AbstractOperator(Templater, DAGNode):
 
     @cached_property
     def extra_links(self) -> list[str]:
-        return 
list(set(self.operator_extra_link_dict).union(self.global_operator_extra_link_dict))
+        return 
sorted(set(self.operator_extra_link_dict).union(self.global_operator_extra_link_dict))
 
     def get_extra_links(self, ti: TaskInstance, link_name: str) -> str | None:
         """For an operator, gets the URLs that the ``extra_links`` entry 
points to.
diff --git a/tests/serialization/test_dag_serialization.py 
b/tests/serialization/test_dag_serialization.py
index c0c0f2f0cd..c449a6f998 100644
--- a/tests/serialization/test_dag_serialization.py
+++ b/tests/serialization/test_dag_serialization.py
@@ -986,7 +986,7 @@ class TestStringifiedDAGs:
         assert serialized_dag["dag"]["tasks"][0]["_operator_extra_links"] == 
serialized_links
 
         # Test all the extra_links are set
-        assert set(simple_task.extra_links) == {*links, "airflow", "github", 
"google"}
+        assert simple_task.extra_links == sorted({*links, "airflow", "github", 
"google"})
 
         dr = dag_maker.create_dagrun(execution_date=test_date)
         (ti,) = dr.task_instances

Reply via email to