vincbeck commented on code in PR #38297:
URL: https://github.com/apache/airflow/pull/38297#discussion_r1530971750
##########
airflow/models/taskinstance.py:
##########
@@ -1839,6 +1839,36 @@ def key(self) -> TaskInstanceKey:
"""Returns a tuple that identifies the task instance uniquely."""
return TaskInstanceKey(self.dag_id, self.task_id, self.run_id,
self.try_number, self.map_index)
+ @staticmethod
+ @internal_api_call
+ @provide_session
+ def _set_state(ti, state, session=NEW_SESSION):
+ TI = TaskInstance
+ if not isinstance(ti, TaskInstance):
+ ti = (
+ session.query(TI)
Review Comment:
I dont know if it is really worth creating a variable for that
```suggestion
TI = TaskInstance
if not isinstance(ti, TaskInstance):
ti = (
session.query(TaskInstance)
```
##########
airflow/models/taskinstance.py:
##########
@@ -1839,6 +1839,36 @@ def key(self) -> TaskInstanceKey:
"""Returns a tuple that identifies the task instance uniquely."""
return TaskInstanceKey(self.dag_id, self.task_id, self.run_id,
self.try_number, self.map_index)
+ @staticmethod
+ @internal_api_call
+ @provide_session
+ def _set_state(ti, state, session=NEW_SESSION):
+ TI = TaskInstance
+ if not isinstance(ti, TaskInstance):
+ ti = (
+ session.query(TI)
Review Comment:
If `not isinstance(ti, TaskInstance)` is `True` then what is the type of
`ti`? Should not we just pass `task_id`, `dag_id`, `run_id` and `map_index` as
parameters? I think the goal is that all AIP-44 related APIs have primary keys
as parameter which we then use to fetch the entity (task instance, dag_run, ...)
--
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]