jason810496 commented on code in PR #72907:
URL: https://github.com/apache/airflow/pull/72907#discussion_r3985145158


##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -1391,6 +1391,15 @@ def validate_inlets_and_outlets(
 
     if not ti.task:
         dr = ti.dag_run
+        if not dr:

Review Comment:
   nit:
   ```suggestion
           if ((dr := ti.dag_run) is None):
   ```



##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_state_store.py:
##########
@@ -87,7 +87,18 @@ def set_task_state_store(
 ) -> None:
     """Set a task state store key, creating or updating the row."""
     scope = _get_task_scope_for_ti(task_instance_id, session)
-    get_state_backend().set(scope, key, json.dumps(body.value), 
expires_at=body.expires_at, session=session)
+    try:
+        get_state_backend().set(
+            scope, key, json.dumps(body.value), expires_at=body.expires_at, 
session=session
+        )
+    except ValueError:

Review Comment:
   Would it be better to define a dedicated exception for the DagRun not found 
(e.g. or leveraging the existing exception) instead of matching ambiguous 
`ValueError` exception? 
   
   
https://github.com/apache/airflow/blob/1952520a9eedb63c530be89eade6863ea975bb2e/airflow-core/src/airflow/state/metastore.py#L242-L270



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