You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/07 07:14:09 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #26993: Fix ti._try_number for deferred and up_for_reschedule tasks

uranusjr commented on code in PR #26993:
URL: https://github.com/apache/airflow/pull/26993#discussion_r1041836684


##########
airflow/api/common/mark_tasks.py:
##########
@@ -154,6 +154,12 @@ def set_state(
             qry_sub_dag = all_subdag_tasks_query(sub_dag_run_ids, session, state, confirmed_dates)
             tis_altered += qry_sub_dag.with_for_update().all()
         for task_instance in tis_altered:
+            # The try_number was decremented when setting to up_for_reschedule and deferred.
+            # Increment it back when changing the state again
+            if task_instance.state is not None and task_instance.state in (
+                State.UP_FOR_RESCHEDULE or State.DEFERRED
+            ):

Review Comment:
   ```suggestion
               if task_instance.state in (
                   TaskInstanceState.UP_FOR_RESCHEDULE, TaskInstanceState.DEFERRED
               ):
   ```
   
   I think this is the intended logic? Since this logic is also duplicated in `www/utils.py`, perhaps we should add an entry in `State` similar to `State.running`?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org