Skip to content

Tag filter doesn't sort tags alphabetically #31547

@arjunanan6

Description

@arjunanan6

Apache Airflow version

Other Airflow 2 version (please specify below)

What happened

Airflow v: 2.6.0

This has been an issue since 2.4.0 for us at least. We recently did a refactor of many of our 160+ DAGs and part of that process was to remove some tags that we didn't want anymore. Unfortunately, the old tags were still left behind when we deployed our new image with the updated DAGs (been a consistent thing across several Airflow versions for us). There is also the issue that the tag filter doesn't sort our tags alphabetically.

I tried to truncate the dag_tag table, and that did help to get rid of the old tags. However, the sorting issue remains. Example:
image

On one of our dev environments, we have just about 10 DAGs with a similar sorting problem, and the dag_tag table had 18 rows. I took a backup of it and truncated the dag_tag table, which was almost instantly refilled (I guess logs are DEBUG level on that, so I saw nothing). This did not initially fix the sorting problem, but after a couple of truncates, things got weird, and all the tags were sorted as expected, and the row count in the dag_tag table was now just 15, so 3 rows were removed in all. We also added a new DAG in there with a tag "arjun", which also got listed first - so all sorted on that environment.

Summary:

  1. Truncating of the dag_tag table got rid of the old tags that we no longer have in our DAGs.
  2. The tags are still sorted incorrectly in the filter (see image).

It seems that the logic here is contained in www/static/js/dags.js. I am willing to submit a PR if I can get some guidance :)

What you think should happen instead

No response

How to reproduce

N/A

Operating System

debian

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions