Skip to content

Commit

Permalink
Remove webserver try_number adjustment (#39623)
Browse files Browse the repository at this point in the history
Previously we had code to compensate for the fact that we were decrementing try_number when deferring or rescheduling.  We can remove this code now.  Just missed this in #39336.
  • Loading branch information
dstandish authored May 14, 2024
1 parent 6621874 commit 029cbae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
8 changes: 1 addition & 7 deletions airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ def get_instance_with_map(task_instance, session):
return get_mapped_summary(task_instance, mapped_instances)


def get_try_count(try_number: int, state: State):
if state in (TaskInstanceState.DEFERRED, TaskInstanceState.UP_FOR_RESCHEDULE):
return try_number + 1
return try_number


priority: list[None | TaskInstanceState] = [
TaskInstanceState.FAILED,
TaskInstanceState.UPSTREAM_FAILED,
Expand Down Expand Up @@ -147,7 +141,7 @@ def get_mapped_summary(parent_instance, task_instances):
"start_date": group_start_date,
"end_date": group_end_date,
"mapped_states": mapped_states,
"try_number": get_try_count(parent_instance.try_number, parent_instance.state),
"try_number": parent_instance.try_number,
"execution_date": parent_instance.execution_date,
}

Expand Down
4 changes: 2 additions & 2 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def set_overall_state(record):
"queued_dttm": task_instance.queued_dttm,
"start_date": task_instance.start_date,
"end_date": task_instance.end_date,
"try_number": wwwutils.get_try_count(task_instance.try_number, task_instance.state),
"try_number": task_instance.try_number,
"note": task_instance.note,
}
for task_instance in grouped_tis[item.task_id]
Expand Down Expand Up @@ -1687,7 +1687,7 @@ def log(self, session: Session = NEW_SESSION):

num_logs = 0
if ti is not None:
num_logs = wwwutils.get_try_count(ti.try_number, ti.state)
num_logs = ti.try_number
logs = [""] * num_logs
root = request.args.get("root", "")
return self.render_template(
Expand Down
4 changes: 2 additions & 2 deletions tests/www/views/test_views_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ def log_admin_client(log_app):
[
(None, 0, 0),
(TaskInstanceState.UP_FOR_RETRY, 2, 2),
(TaskInstanceState.UP_FOR_RESCHEDULE, 0, 1),
(TaskInstanceState.UP_FOR_RESCHEDULE, 1, 2),
(TaskInstanceState.UP_FOR_RESCHEDULE, 0, 0),
(TaskInstanceState.UP_FOR_RESCHEDULE, 1, 1),
(TaskInstanceState.RUNNING, 1, 1),
(TaskInstanceState.SUCCESS, 1, 1),
(TaskInstanceState.FAILED, 3, 3),
Expand Down

0 comments on commit 029cbae

Please sign in to comment.