jason810496 commented on code in PR #46484:
URL: https://github.com/apache/airflow/pull/46484#discussion_r1966492515


##########
airflow/models/dagrun.py:
##########
@@ -314,7 +314,11 @@ def validate_run_id(self, key: str, run_id: str) -> str | 
None:
     @property
     def dag_versions(self) -> list[DagVersion]:
         """Return the DAG versions associated with the TIs of this DagRun."""
-        dag_versions = list(dict.fromkeys(list(self._tih_dag_versions) + 
list(self._ti_dag_versions)))
+        dag_versions = [
+            dv
+            for dv in dict.fromkeys(list(self._tih_dag_versions) + 
list(self._ti_dag_versions))
+            if dv is not None
+        ]
         sorted_ = sorted(dag_versions, key=lambda dv: dv.id)

Review Comment:
   I have tried fix by the following, but result in the same error.
   ```python
   if not dag_versions:
       return []
   ```
   > It’s because some TI or TIH do not find the related version. That might 
not be a real use case, just a test thing. TI has no dag version initialized in 
the test.
   
   Agree, maybe refactor the `setup_dag_runs` in `TestRecentDagRuns` with 
`dag_maker.create_dagrun` would resolve the "test thing" case.
   



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