kaxil commented on code in PR #45074:
URL: https://github.com/apache/airflow/pull/45074#discussion_r1892037231


##########
airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -252,11 +256,12 @@ def ti_update_state(
         query = TI.duration_expression_update(ti_patch_payload.end_date, 
query, session.bind)
         # clear the next_method and next_kwargs so that none of the retries 
pick them up
         query = query.values(state=State.UP_FOR_RESCHEDULE, next_method=None, 
next_kwargs=None)
+        updated_state = State.UP_FOR_RESCHEDULE
     # TODO: Replace this with FastAPI's Custom Exception handling:
     # 
https://fastapi.tiangolo.com/tutorial/handling-errors/#install-custom-exception-handlers
     try:
         result = session.execute(query)
-        log.info("TI %s state updated: %s row(s) affected", ti_id_str, 
result.rowcount)
+        log.info("TI %s state updated to %s: %s row(s) affected", ti_id_str, 
updated_state, result.rowcount)

Review Comment:
   You could simplify and just do `ti_patch_payload.state` here and avoid 
changed on L259, L237 and L212



##########
airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -252,11 +256,12 @@ def ti_update_state(
         query = TI.duration_expression_update(ti_patch_payload.end_date, 
query, session.bind)
         # clear the next_method and next_kwargs so that none of the retries 
pick them up
         query = query.values(state=State.UP_FOR_RESCHEDULE, next_method=None, 
next_kwargs=None)
+        updated_state = State.UP_FOR_RESCHEDULE
     # TODO: Replace this with FastAPI's Custom Exception handling:
     # 
https://fastapi.tiangolo.com/tutorial/handling-errors/#install-custom-exception-handlers
     try:
         result = session.execute(query)
-        log.info("TI %s state updated: %s row(s) affected", ti_id_str, 
result.rowcount)
+        log.info("TI %s state updated to %s: %s row(s) affected", ti_id_str, 
updated_state, result.rowcount)

Review Comment:
   You could simplify and just do `ti_patch_payload.state` here and avoid 
changes on L259, L237 and L212



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