Adaverse commented on issue #32290:
URL: https://github.com/apache/airflow/issues/32290#issuecomment-1619045557

   I looked into it, the endpoint 
`api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}` and it was 
giving the right result. In the code, it is seems to be attached to the field 
`_try_number`
   ```
   _try_number = auto_field(data_key="try_number")
   ```
   but the one we see in the UI is `try_number` attribute from `TaskInstance` 
model which is `_try_number + 1`. So we can instead of showing `try_number` we 
can show `_try_number` in the UI as seen below - 
   ```
       @hybrid_property
       def try_number(self):
           """
           Return the try number that this task number will be when it is 
actually
           run.
   
           If the TaskInstance is currently running, this will match the column 
in the
           database, in all other cases this will be incremented.
           """
           # This is designed so that task logs end up in the right file.
           if self.state == State.RUNNING:
               return self._try_number
           return self._try_number + 1
   ```
   
   Will open a PR for this.


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