uranusjr commented on code in PR #27898:
URL: https://github.com/apache/airflow/pull/27898#discussion_r1031919036
##########
airflow/models/taskinstance.py:
##########
@@ -719,6 +719,7 @@ def current_state(self, session: Session = NEW_SESSION) ->
str:
.filter(
TaskInstance.dag_id == self.dag_id,
TaskInstance.task_id == self.task_id,
+ TaskInstance.map_index == self.map_index,
Review Comment:
It’s probably a good chance to rewrite this to something like
```python
from sqlalchemy.inspection import inspect
session.query(TaskInstance.state).filter(
col == getattr(self, col.name)
for col in inspect(TaskInstance).primary_key
).scalar()
```
This would be resilient to any primary key changes in the future.
--
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]