potiuk commented on code in PR #28900:
URL: https://github.com/apache/airflow/pull/28900#discussion_r1308436541


##########
airflow/models/dag.py:
##########
@@ -1373,6 +1374,40 @@ def normalized_schedule_interval(self) -> 
ScheduleInterval:
             _schedule_interval = self.schedule_interval
         return _schedule_interval
 
+    @staticmethod
+    @internal_api_call
+    @provide_session
+    def fetch_callback(
+        dag: DAG,
+        dagrun: DagRun | DagRunPydantic,

Review Comment:
   This will also help to clarify that in all the methods only called from the 
`internal_api` decorated methods, we should just bass the ORM objects. There 
were a few methods below where we missed typing for taskinstance and dagrun - 
and they are just called from "inside" of the `internal_api` calls - and they 
should simply get a TaskInstance and DagRun as parameters.
   
   It really only makes sense to "retrieve" the DagRunPydantic objects to 
client, but any updates we make we should make as `update(dag_run_id: str, 
with_this_information: ....)` kind of method. While Pydantic provides us with 
an easy way to convert from ORM objects to Pydantic ones, the conversion back 
is not easy and we do not even really need to do it.
   
   cc: @uranusjr and  @mhenc also for discussion on it.



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