Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try number is incorrect #32290

Closed
1 of 2 tasks
aamster opened this issue Jun 30, 2023 · 1 comment · Fixed by #32361
Closed
1 of 2 tasks

Try number is incorrect #32290

aamster opened this issue Jun 30, 2023 · 1 comment · Fixed by #32361
Assignees
Labels
area:core kind:bug This is a clearly a bug

Comments

@aamster
Copy link

aamster commented Jun 30, 2023

Apache Airflow version

2.6.2

What happened

All tasks were run 1 time. The try number is 2 for all tasks

What you think should happen instead

Try number should be 1 if only tried 1 time

How to reproduce

Run a task and use the UI to look up try number

Operating System

centos

Versions of Apache Airflow Providers

No response

Deployment

Virtualenv installation

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@aamster aamster added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Jun 30, 2023
@pankajastro pankajastro removed the needs-triage label for new issues that we didn't triage yet label Jul 2, 2023
@Adaverse
Copy link
Contributor

Adaverse commented Jul 3, 2023

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 for finished tasks

    @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

So we can, instead of showing try_number we can show _try_number in the UI.

Will open a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants