kaxil commented on code in PR #55169:
URL: https://github.com/apache/airflow/pull/55169#discussion_r2318321794


##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -2322,10 +2335,15 @@ class SerializedDAG(DAG, BaseSerialization):
 
     _decorated_fields: ClassVar[set[str]] = {"default_args", "access_control"}
 
-    last_loaded: datetime.datetime | None = attrs.field(init=False, 
factory=utcnow)
+    # TODO (GH-52141): These should contain serialized containers, but 
currently
+    # this class inherits from an SDK one.
+    task_group: SerializedTaskGroup  # type: ignore[assignment]
+    task_dict: dict[str, SerializedBaseOperator | SerializedMappedOperator]  # 
type: ignore[assignment]
+
+    last_loaded: datetime.datetime
     # this will only be set at serialization time
     # it's only use is for determining the relative fileloc based only on the 
serialize dag
-    _processor_dags_folder: str = attrs.field(init=False)

Review Comment:
   Do we need this at init time now?



##########
airflow-core/tests/unit/models/test_taskinstance.py:
##########
@@ -151,6 +151,7 @@ def setup_method(self):
     def teardown_method(self):
         self.clean_db()
 
+    @pytest.mark.need_serialized_dag(False)

Review Comment:
   Yeah, this test should be in sdk.
   
   Anyways unrelated to the PR



##########
airflow-core/tests/unit/utils/test_task_group.py:
##########
@@ -195,11 +197,10 @@
             "tooltip": "",
             "type": "task",
         },
-        {"id": "task5", "label": "task5", "operator": "EmptyOperator", "type": 
"task"},
     ],

Review Comment:
   Do you know why order changed?



##########
airflow-core/tests/unit/utils/test_task_group.py:
##########
@@ -195,11 +197,10 @@
             "tooltip": "",
             "type": "task",
         },
-        {"id": "task5", "label": "task5", "operator": "EmptyOperator", "type": 
"task"},
     ],
     "id": None,
     "is_mapped": False,
-    "label": None,
+    "label": "",

Review Comment:
   Intentionally storing empty string? Instead of None?



##########
airflow-core/tests/unit/models/test_dagrun.py:
##########
@@ -873,34 +825,32 @@ def test_get_latest_runs(self, dag_maker, session):
                 assert dagrun.logical_date == timezone.datetime(2015, 1, 2)
 
     def test_removed_task_instances_can_be_restored(self, dag_maker, session):
-        def with_all_tasks_removed(dag):
-            with dag_maker(
-                dag_id=dag.dag_id,
+        def create_dag():
+            return dag_maker(
+                dag_id="test_task_restoration",
                 schedule=datetime.timedelta(days=1),
-                start_date=dag.start_date,
-            ) as dag:
-                pass
-            return dag
+                start_date=DEFAULT_DATE,

Review Comment:
   Untelated but we shouldn't need start date



##########
airflow-core/tests/unit/models/test_dagrun.py:
##########
@@ -570,21 +544,15 @@ def test_end_dr_span_if_needed(self, testing_dag_bundle, 
dag_maker, session):
             schedule=datetime.timedelta(days=1),
             start_date=datetime.datetime(2017, 1, 1),
         ) as dag:
-            ...
-        SerializedDAG.bulk_write_to_db("testing", None, dags=[dag], 
session=session)
-
-        dag_task1 = EmptyOperator(task_id="test_task1", dag=dag)
-        dag_task2 = EmptyOperator(task_id="test_task2", dag=dag)
-        dag_task1.set_downstream(dag_task2)
+            dag_task1 = EmptyOperator(task_id="test_task1")
+            dag_task2 = EmptyOperator(task_id="test_task2")
+            dag_task1.set_downstream(dag_task2)
 
         initial_task_states = {
             "test_task1": TaskInstanceState.SUCCESS,
             "test_task2": TaskInstanceState.SUCCESS,
         }
 
-        # Scheduler uses Serialized DAG -- so use that instead of the Actual 
DAG
-        dag = SerializedDAG.from_dict(SerializedDAG.to_dict(dag))

Review Comment:
   Does the dagmaker default to serialized dag here?
   
   Reviewing from mobile so difficult to view entire file quickly to check 
markers (if any)



##########
airflow-core/tests/unit/utils/test_task_group.py:
##########
@@ -503,18 +516,6 @@ def test_task_group_to_dict_and_dag_edges(dag_maker):
                     {"id": "group_a.downstream_join_id"},
                 ],
             },
-            {
-                "id": "group_c",

Review Comment:
   Same: was ordering wrong before? I had looked into it earlier and it seemed 
the UI showed topological sort and had option to show alphabetical 



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