xBis7 commented on code in PR #56187:
URL: https://github.com/apache/airflow/pull/56187#discussion_r2587718694
##########
airflow-core/tests/integration/otel/test_otel.py:
##########
@@ -610,7 +610,7 @@ class TestOtelIntegration:
"--daemon",
]
- dags: dict[str, DAG] = {}
+ dags: dict[str, SerializedDAG] = {}
Review Comment:
Not a bug causing test failures but I wanted to get rid of a mypy warning
because the dictionary actually holds a `SerializedDAG` and not a `DAG` object.
Assignment
```python
cls.dags = cls.serialize_and_get_dags()
```
https://github.com/xBis7/airflow/blob/0d74d25c67d795b1ddb901d93ddce5614a1dadb2/airflow-core/tests/integration/otel/test_otel.py#L651
Then `serialize_and_get_dags()` returns
```python
return dag_dict
```
https://github.com/xBis7/airflow/blob/0d74d25c67d795b1ddb901d93ddce5614a1dadb2/airflow-core/tests/integration/otel/test_otel.py#L706
which is declared and initialized as
```python
dag_dict: dict[str, SerializedDAG] = {}
```
https://github.com/xBis7/airflow/blob/0d74d25c67d795b1ddb901d93ddce5614a1dadb2/airflow-core/tests/integration/otel/test_otel.py#L662
```python
with create_session() as session:
for dag_id in dag_ids:
dag = dag_bag.get_dag(dag_id)
...
...
...
if
session.query(DagBundleModel).filter(DagBundleModel.name == "testing").count()
== 0:
session.add(DagBundleModel(name="testing"))
session.commit()
SerializedDAG.bulk_write_to_db(
bundle_name="testing", bundle_version=None,
dags=[dag], session=session
)
dag_dict[dag_id] =
SerializedDAG.deserialize_dag(SerializedDAG.serialize_dag(dag))
else:
dag.sync_to_db(session=session)
dag_dict[dag_id] = dag
```
https://github.com/xBis7/airflow/blob/0d74d25c67d795b1ddb901d93ddce5614a1dadb2/airflow-core/tests/integration/otel/test_otel.py#L671-L680
--
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]