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

TaskInstance::log_url's webpage does not provide a link or mechanism to view the DAG run #39179

Closed
2 tasks done
AetherUnbound opened this issue Apr 22, 2024 · 2 comments
Closed
2 tasks done
Labels
area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet

Comments

@AetherUnbound
Copy link
Contributor

AetherUnbound commented Apr 22, 2024

Apache Airflow version

2.9.0

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

No response

What happened?

See WordPress/openverse#4177 for a specific case.

When viewing a URL generated by TaskInsatnce::log_url, this directs the user to a /log page. This page has the DAG ID and the enable/disable switch at the top, but no link to get to the DAG's grid or graph view. Additionally, the schedule information in the top right of the page will always show as Schedule: False on the /log page, even if the DAG has a schedule.

@property
def log_url(self) -> str:
"""Log URL for TaskInstance."""
iso = quote(self.execution_date.isoformat())
base_url = conf.get_mandatory_value("webserver", "BASE_URL")
return (
f"{base_url}"
"/log"
f"?execution_date={iso}"
f"&task_id={self.task_id}"
f"&dag_id={self.dag_id}"
f"&map_index={self.map_index}"
)

The "Log Url" that shows up in the "Task Instances" browse page of the webserver apparently uses a link to the grid view rather than /log directly. This seems to be because it's constructed directly:

airflow/airflow/www/views.py

Lines 5186 to 5205 in b0e9613

def log_url_formatter(self):
"""Format log URL."""
dag_id = self.get("dag_id")
task_id = self.get("task_id")
run_id = self.get("run_id")
map_index = self.get("map_index", None)
if map_index == -1:
map_index = None
url = url_for(
"Airflow.grid",
dag_id=dag_id,
task_id=task_id,
dag_run_id=run_id,
map_index=map_index,
tab="logs",
)
return Markup(
'<a href="{log_url}"><span class="material-icons" aria-hidden="true">reorder</span></a>'
).format(log_url=url)

What you think should happen instead?

It would be helpful if the /log page (and thus the link generated by TaskInstance::log_url) had a way to view the entire DAG in the graph & grid views. So much work has been done on the new DAG view (which rocks!) - that would be the ideal view to be directed to IMO rather than a standalone log page that requires navigation to the DAGs list then navigation to the DAG then navigation to the right DAG run and task in order to actually view the failure in the context of the entire DAG.

How to reproduce

Run a task which prints out ti.log_url, then visit that URL and observe that there's no way to navigate back to the DAG.

Operating System

Official docker image

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

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

@AetherUnbound AetherUnbound added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Apr 22, 2024
@AetherUnbound AetherUnbound changed the title TaskInstance::log_url's webpage does not provide a link or mechanism to view the DAG run TaskInstance::log_url's webpage does not provide a link or mechanism to view the DAG run Apr 22, 2024
@RNHTTR
Copy link
Collaborator

RNHTTR commented Apr 22, 2024

I believe this is a duplicate of #39023 -- @AetherUnbound let me know if you'd like me to assign you to that one!

@RNHTTR RNHTTR closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
@AetherUnbound
Copy link
Contributor Author

Ah, it is indeed! And sure! I've commented there, please go ahead and assign it to me 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet
Projects
None yet
Development

No branches or pull requests

2 participants