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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links to dagruns beyond last 25 runs don't work (take 3) #39642

Open
1 of 2 tasks
hterik opened this issue May 15, 2024 · 2 comments
Open
1 of 2 tasks

Links to dagruns beyond last 25 runs don't work (take 3) #39642

hterik opened this issue May 15, 2024 · 2 comments
Labels
affected_version:2.9 area:core area:UI Related to UI/UX. For Frontend Developers. kind:bug This is a clearly a bug

Comments

@hterik
Copy link
Contributor

hterik commented May 15, 2024

Apache Airflow version

2.9.1

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

No response

What happened?

This is a continuation of #34723 that was fixed in #34887, later fixed again in #37018, reported as problematic for other reasons in #38939, then later fixed yet again in #38941.
Unfortunatelly the issue still remains.

In short, the problem is that the grid view by default only shows 25 dagruns, with base_date starting at current time. If dag_run_id query parameter points to a dag run that is older than today - 25 runs, it will not be pre-selected. This makes it impossible to permalink to specific runs, without knowing in advance the base_date for that run.

1.Start 50 instances of dag mydag and wait for them to complete
2. Visit Browse -> Task Instances list: airflow/taskinstance/list/?_flt_3_dag_id=mydag
3. Scroll to the bottom and click on the oldest run, in the Task Id column, this link will look something like /dags/mydag/grid?task_id=mytask&dag_run_id=123456&tab=graph
4. Dag grid view opens, but no dagrun is selected. 🙁

What you think should happen instead?

Dag grid should open and have dag_run_id=123456 selected.

It appears like there are two different endpoints, one called /graph, that does handle redirecting the base_date to include older runs, and another called /grid that doesn't.
When browsing from the Browse -> DAG runs list instead, it uses the /graph endpoint and there the links work, even for older runs. 👍
@bbovenzi, do you know if the /graph is the one to use for all permalink purposes and this solves these base_date issues?

How to reproduce

Operating System

Debian Bookworm

Versions of Apache Airflow Providers

No response

Deployment

Other Docker-based deployment

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

@hterik hterik added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels May 15, 2024
@RNHTTR RNHTTR added area:UI Related to UI/UX. For Frontend Developers. and removed needs-triage label for new issues that we didn't triage yet labels May 15, 2024
@RNHTTR
Copy link
Collaborator

RNHTTR commented May 15, 2024

There's some additional bizarre behavior that might be related. When clicking on the logs icon from Browse -> Task Instances, it only shows a single DAG run (the only one that was scheduled -- the other ~40 were triggered by button mashing), and it says "No XCom" where the logs should be:

image

@mpolatcan
Copy link
Contributor

mpolatcan commented May 27, 2024

Hi @hterik, we faced same issue too. Problem is that task_instance.log_url generates log url to page that has this error. So, I resolved issue by generating custom execution log url with below function and use in operator callbacks for our Slack notifications. Basically, function generate url to see full execution log, not routes traffic to grid view 😅:

from datetime import datetime
from urllib.parse import quote

def __generate_execution_log_url(context: dict):
    dag_id = context["dag_run"].dag_id
    task_instance = context["ti"]
    task_id = task_instance.task_id
    encoded_execution_date = quote(task_instance.execution_date.strftime("%Y-%m-%dT%H:%M:%S.%f%z"))

    return f"https://airflow.example.com/log?dag_id={dag_id}&task_id={task_id}&execution_date={encoded_execution_date}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected_version:2.9 area:core area:UI Related to UI/UX. For Frontend Developers. kind:bug This is a clearly a bug
Projects
None yet
Development

No branches or pull requests

4 participants