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

can't see failed sensor task log on webpage #26960

Closed
1 of 2 tasks
shokosanma opened this issue Oct 10, 2022 · 9 comments · Fixed by #26993
Closed
1 of 2 tasks

can't see failed sensor task log on webpage #26960

shokosanma opened this issue Oct 10, 2022 · 9 comments · Fixed by #26993
Labels
area:core kind:bug This is a clearly a bug

Comments

@shokosanma
Copy link

Apache Airflow version

2.4.1

What happened

image
when the sensor running, I can see the log above, but when I manual set the task state to failed or the task failed by other reason, I can't see log at here
image
In other version airflow, like 2.3/2.2, this still happens

What you think should happen instead

No response

How to reproduce

No response

Operating System

Ubuntu 20.04.4 LTS (Focal Fossa)

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

@shokosanma shokosanma added area:core kind:bug This is a clearly a bug labels Oct 10, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 10, 2022

Thanks for opening your first issue here! Be sure to follow the issue template!

@potiuk potiuk added the invalid label Oct 10, 2022
@potiuk
Copy link
Member

potiuk commented Oct 10, 2022

When the tasks runs and fails you will see the logs you must have made a mistake..

When you manually set it to failed you will not see logs. This is expected behaviour because when you set the tasks to failed before manually runing the task it does not produce any log.

@potiuk potiuk closed this as completed Oct 10, 2022
@shokosanma
Copy link
Author

When the tasks runs and fails you will see the logs you must have made a mistake..

When you manually set it to failed you will not see logs. This is expected behaviour because when you set the tasks to failed before manually runing the task it does not produce any log.

there may be some misunderstanding, I want to express that the sensor has been running for a while and produce some log, when the error happen or manually set to failed, the old produced log can't be seen on webpage but can be found in /opt/airflow/logs.

@potiuk potiuk reopened this Oct 10, 2022
@potiuk
Copy link
Member

potiuk commented Oct 10, 2022

Can you see if there are any errors in the console of your browser? Without it it is impossible to diagnose it.

@potiuk
Copy link
Member

potiuk commented Oct 10, 2022

Generally - please explain more details what you do - otherwise it might be impossible to solve.

(BTW,. The more information you provide the higher chance you will get that someone wiil help to solve your problem - for example you never mentioned that the logs are there, were there and disappeared - hence it was not "misunderstanding" but lack of sufficient information).

@shokosanma
Copy link
Author

shokosanma commented Oct 10, 2022

sorry, let me post more detail, my dag is like this

from airflow.utils.dates import days_ago
from airflow.decorators import dag
from airflow.sensors.python import PythonSensor
import time


args = {
    # Airflow above 1.8.0 require a fixed start_date
    "start_date": days_ago(1),
    "catchup": None,
    "provide_context": True,
    "queue": "",
}

@dag(
    dag_id="test_sensor",
    default_args=args,
    schedule_interval=None,
    max_active_runs=2,
    tags=["test"],
)
def test():
    def bo():
        for i in range(10):
            time.sleep(1)
            print(i)
        return False

    ob = PythonSensor(
        task_id="ob",
        poke_interval=60,
        mode='reschedule',
        python_callable=bo,
        timeout=3600*6
    )

    ob

d = test()

when the task is in running/up_for_reschedule state, checking log will send a get requests to http://localhost:8080/get_logs_with_metadata?dag_id=test_sensor&task_id=ob&map_index=-1&execution_date=2022-10-10T07%3A27%3A13.805132%2B00%3A00&try_number=1&metadata=null
image

when the task in up_for_reschedule state, manually set task to failed or the task change to failed state with some unknown reason, the brower will not send the requests above
image
the console
image

@potiuk
Copy link
Member

potiuk commented Oct 10, 2022

cc: @bbovenzi / @pierrejeambrun -> this one seems interesting (no time to verify it though before going for vacation).

@bbovenzi
Copy link
Contributor

@shokosanma I think I've replicated the issue. But can you check if the logs for that task instance show up in the grid view?
We calculate the try number in a different way for each view. We should probably make that more consistent.

@shokosanma
Copy link
Author

@bbovenzi thanks.
And in version 2.4, I can see log in grid view, but it is hard to view log in old version airflow, so it helps for debugging in old versions.
image

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants