vincbeck commented on code in PR #29513:
URL: https://github.com/apache/airflow/pull/29513#discussion_r1107319000


##########
airflow/models/taskinstance.py:
##########
@@ -1207,9 +1208,11 @@ def get_dagrun(self, session: Session = NEW_SESSION) -> 
DagRun:
 
         return dr
 
+    @staticmethod
+    @internal_api_call
     @provide_session
     def check_and_change_state_before_execution(
-        self,
+        ti: TaskInstance,

Review Comment:
   Agree on this one. I tried to do this while working on 
#[28900](https://github.com/apache/airflow/pull/28900) and basically call 
`TaskInstance.get_task_instance` in the method itself instead of passing the 
whole `TaskInstance` object. Though, I confess, I got lazy and did not do it 
for all methods since #29355 was coming. 
   
   However, it will add some additional database calls when the DB isolation is 
turned off, I am just not sure of the consequences of it (is it sustainable or 
not). Since it is simple queries on primary key, it seems okay to me.
   
   Also, while working on #28900, I found it hard to know whether an object 
(e.g. DAG, DagRun, ...) could be passed as parameter (then serialized) or not 
and then use the technique suggested in the proposal to pass primary keys and 
then retrieve the object. It would be great/helpful if we can make the 
inventory of objects which can be serialized and objects which cannot



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