uranusjr commented on a change in pull request #18642:
URL: https://github.com/apache/airflow/pull/18642#discussion_r720781587
##########
File path: airflow/api_connexion/endpoints/task_instance_endpoint.py
##########
@@ -286,9 +286,14 @@ def post_set_task_instances_state(dag_id, session):
error_message = f"Task ID {task_id} not found"
raise NotFound(error_message)
+ execution_date = data['execution_date']
+ ti = session.query(TI).filter_by(execution_date=execution_date,
task_id=task_id, dag_id=dag_id).one_or_none()
+ if not ti:
+ raise NotFound(f"Task instance not found for task {task_id} on
execution_date {execution_date}")
Review comment:
Probably can just be
```python
try:
ti = session.query(TI)...one()
except NoResultFound:
raise NotFound(...)
--
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]