kacpermuda commented on code in PR #69873:
URL: https://github.com/apache/airflow/pull/69873#discussion_r3587002675


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -222,7 +222,9 @@ def patch_dag_run(
 
     data = patch_body.model_dump(include=fields_to_update, by_alias=True)
 
-    for attr_name, attr_value_raw in data.items():
+    # Sort keys so that the "note" update happens before "state" update, so 
that the listeners called inside
+    # `patch_dag_run_state()` already receive updated DagRun object with note.
+    for attr_name, attr_value_raw in sorted(data.items()):

Review Comment:
   Thanks, that makes sense, improved this piece of code by removing the loop 
entirely and just ordering calls explicitly. @pierrejeambrun do you mind 
linking the taskinstance PR? Would love to track it and make sure these fixes 
are all merged, included in next release and backported.



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