Skip to content

Update Airflow 2 UI links for Airflow 3 #46902

Closed

Description

@tirkarthi

Apache Airflow version

main (development)

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

No response

What happened?

Airflow 2 has email_on_failure and other actions that generate links to Airflow 2 UI. This will result in 404 in Airflow 3 once old UI is removed and should be updated. Some of the links I found

@property
def log_url(self) -> str:
"""Log URL for TaskInstance."""
run_id = quote(self.run_id)
base_url = conf.get_mandatory_value("webserver", "BASE_URL")
map_index = f"&map_index={self.map_index}" if self.map_index >= 0 else ""
_log_uri = (
f"{base_url}"
f"/dags"
f"/{self.dag_id}"
f"/grid"
f"?dag_run_id={run_id}"
f"&task_id={self.task_id}"
f"{map_index}"
"&tab=logs"
)
if self.logical_date:
base_date = quote(self.logical_date.strftime("%Y-%m-%dT%H:%M:%S%z"))
_log_uri = f"{_log_uri}&base_date={base_date}"
return _log_uri

@property
def mark_success_url(self) -> str:
"""URL to mark TI success."""
base_url = conf.get_mandatory_value("webserver", "BASE_URL")
return (
f"{base_url}"
"/confirm"
f"?task_id={self.task_id}"
f"&dag_id={self.dag_id}"
f"&dag_run_id={quote(self.run_id)}"
"&upstream=false"
"&downstream=false"
"&state=success"
)

What you think should happen instead?

No response

How to reproduce

  1. Create a dag with email_on_failure = True .
  2. Check failure email link to have log url to Airflow 3 UI.

Operating System

Ubuntu 20.04

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

Activity

  1. added
    area:UIRelated to UI/UX. For Frontend Developers.
    on Feb 19, 2025
  2. aditya0yadav commented on Feb 20, 2025

    @aditya0yadav
    Contributor

    please assign this to me

  3. tirkarthi commented on Feb 26, 2025

    @tirkarthi
    ContributorAuthor

    Thanks @aditya0yadav, assigned.

  4. tirkarthi commented on Mar 7, 2025

    @tirkarthi
    ContributorAuthor

    @aditya0yadav Please let me know if you are you still working on this? If not I can raise a PR for this before the RC release. Thanks.

  5. aditya0yadav commented on Mar 7, 2025

    @aditya0yadav
    Contributor

    @tirkarthi by tommorow i will raise the pr

  6. aditya0yadav commented on Mar 9, 2025

    @aditya0yadav
    Contributor

    do i have to change the test for the task instance right

  7. tirkarthi commented on Mar 9, 2025

    @tirkarthi
    ContributorAuthor

    Yes, the tests test_log_url and test_mark_success_url in test_taskinstance.py should be updated .

  8. aditya0yadav commented on Mar 10, 2025

    @aditya0yadav
    Contributor

    Closes #47550.
    If any changes are needed, please let me know.

  9. tirkarthi commented on Mar 10, 2025

    @tirkarthi
    ContributorAuthor

    @aditya0yadav You have two PRs with one containing only test change. The fix and test case update should be part of same PR. Please also test the URLs constructed to be valid.

    #47542
    #47550

  10. aditya0yadav commented on Mar 10, 2025

    @aditya0yadav
    Contributor

    Sorry, it happened by mistake

  11. added this to the Airflow 3.0.0 milestone on Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AIP-38Modern Web Applicationaffected_version:main_branchIssues Reported for main brancharea:UIRelated to UI/UX. For Frontend Developers.area:corekind:bugThis is a clearly a bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions