apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.84k stars 14.25k forks source link

When the task is in the up_for_retry or rescheduler state, logs cannot be obtained #43209

Open stursdsafdaf opened 4 days ago

stursdsafdaf commented 4 days ago

Apache Airflow version

Other Airflow 2 version (please specify below)

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

2.9.3

What happened?

When the task is in the up_for_retry or rescheduler state, logs cannot be obtained. As shown in the figure, only the hostname is displayed

iShot_2024-10-21_16 33 44

What you think should happen instead?

Tasks in the up_for_retry and rescheduler states have been executed but failed and are in the retry phase. Logs should be displayed normally.

How to reproduce

I deployed 3 nodes and did not enable remote logging. This happens if the task is running on a non-web node and is in the up_for_retry or rescheduler state.

Operating System

ubuntu 20.04

Versions of Apache Airflow Providers

apache-airflow-providers-celery==3.7.3 apache-airflow-providers-common-io==1.3.2 apache-airflow-providers-common-sql==1.14.2 apache-airflow-providers-fab==1.2.2 apache-airflow-providers-ftp==3.10.0 apache-airflow-providers-http==4.12.0 apache-airflow-providers-imap==3.6.1 apache-airflow-providers-mysql==5.6.3 apache-airflow-providers-redis==3.7.1 apache-airflow-providers-smtp==1.7.1 apache-airflow-providers-sqlite==3.8.1

Deployment

Virtualenv installation

Deployment details

I use Python virtual environment deployment, the configuration is as attached airflow_new.txt

Anything else?

code file :lib/python3.8/site-packages/airflow/utils/log/file_task_handler.py This code will result in only getting the log of the node where the web is located when remote logging is not used, so only the host name will be output

iShot_2024-10-21_16 51 24

So, it should be changed to this

iShot_2024-10-21_16 53 15

Are you willing to submit PR?

Code of Conduct

boring-cyborg[bot] commented 4 days ago

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

potiuk commented 1 day ago

Looks playsible. WDYT @dstandish ?

AllardQuek commented 1 hour ago

Hi @stursdsafdaf, I am also facing a similar issue on v2.7.3. May I check if your proposed solution worked for you?

I noticed there is a previously merged PR #39496 that seems to perform a similar fix, though the changes do not seem to be included in the latest version. As I'm new to Airflow, could anyone confirm if the changes from #39496 would solve this issue?