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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying "actual" try number in TaskInstance view #34635

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions airflow/models/taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,18 @@ def try_number(self):
"""
return _get_try_number(task_instance=self)

@try_number.expression
def try_number(cls):
"""
This is what will be used by SQLAlchemy when filtering on try_number.

This is required because the override in the get_try_number function causes
try_number values to be off by one when listing tasks in the UI.

:meta private:
"""
return cls._try_number

@try_number.setter
def try_number(self, value: int) -> None:
"""
Expand Down
6 changes: 2 additions & 4 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5475,7 +5475,7 @@ class TaskInstanceModelView(AirflowModelView):
"priority_weight",
"queue",
"queued_dttm",
"try_number",
"prev_attempted_tries",
"pool",
"queued_by_job_id",
"external_executor_id",
Expand Down Expand Up @@ -5504,9 +5504,7 @@ class TaskInstanceModelView(AirflowModelView):
"queued_by_job_id",
]

label_columns = {
"dag_run.execution_date": "Logical Date",
}
label_columns = {"dag_run.execution_date": "Logical Date", "prev_attempted_tries": "Try Number"}

search_columns = [
"state",
Expand Down