Skip to content

Retrieving logs for previous task attempts uses the wrong task instance ID #51525

@ianbuss

Description

@ianbuss

Apache Airflow version

3.0.1

If "Other Airflow 2 version" selected, which one?

No response

What happened?

The URL template for log retrieval for task instance attempts uses the current TI ID from the task_instance table, not the TI ID for the attempt itself (which is now in the TI history table). This breaks log retrieval if providing a non-default log_filename_template which references the ID e.g. {{ ti.id }}.

What you think should happen instead?

The log retrieval logic should set the TI ID in the template expansion to the ID of the actual attempt.

How to reproduce

Set the log filename template to something non-default including {{ ti.id }}. Run a task and validate logs can be retrieved. Clear the task instance and try to retrieve logs for the previous attempt.

Operating System

Debian GNU/Linux

Versions of Apache Airflow Providers

No response

Deployment

Astronomer

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

Metadata

Metadata

Assignees

Labels

area:corearea:loggingkind:bugThis is a clearly a bugpriority:mediumBug that should be fixed before next release but would not block a release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions