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

Auto tail file logs in Web UI #26169

Merged

Conversation

jscheffl
Copy link
Contributor

@jscheffl jscheffl commented Sep 5, 2022

This PR implements a log tail feature on file_task_handler

As described in #15783 it would be a great feature to have log tail available in Airflow UI so that if you watch something running you don't need to hit the F5 key constantly to follow the running task.

Actually I saw the same demand and with this PR want to contribute this feature upstream.

I wanted to implement this from scratch when I realized that an auto-tail is already implemented in the UI, just the back-end needs to feed data in a way that tail is active. So this PR is a minimal-invasive implementation on the file_task_handler.py alongside with small adjustments to inheriting provider implementation.

closes: #15783
related: #15783

How to test:

  • Start a long running DAG based on an airflow instance from this branch and see that the running task instance which produces logs will add content to the view.

Example DAG I used for testing, running 200 seconds and adding log lines every second:

import pendulum

from airflow import DAG
from airflow.operators.bash import BashOperator

with DAG(
    dag_id='a_log_running_dag',
    schedule='0 * * * *',
    start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
    catchup=False,
) as dag:
    BashOperator(
        task_id='runme',
        bash_command='for i in {1..200}; do echo $i; sleep 1; done',
    )

@boring-cyborg boring-cyborg bot added area:logging area:providers area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues provider:amazon-aws AWS/Amazon - related issues provider:microsoft-azure Azure-related issues provider:google Google (including GCP) related issues labels Sep 5, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 5, 2022

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@jscheffl jscheffl changed the title Feature/15783 auto tail file logs in UI Auto tail file logs in Web UI Sep 5, 2022
@jscheffl jscheffl force-pushed the feature/15783-auto-tail-file-logs-in-ui branch 2 times, most recently from 8bbfbcb to 7633a6f Compare September 6, 2022 20:29
Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire log structure needs some love and refactoring work.

@jscheffl jscheffl force-pushed the feature/15783-auto-tail-file-logs-in-ui branch from 6fe8ff8 to afc8225 Compare September 8, 2022 09:45
@jscheffl
Copy link
Contributor Author

Hi @uranusjr Thanks for the review, the PR is "stale" now since a few days. Are further reviews needed? If yes, please let me know whom to get in touch with. Otherwise, if all is okay, who would be eligible to merge? (preventing further conflicts)

@potiuk potiuk merged commit 1f7b296 into apache:main Sep 18, 2022
@potiuk potiuk added this to the Airflow 2.4.1 milestone Sep 18, 2022
@ephraimbuddy ephraimbuddy added the type:new-feature Changelog: New Features label Nov 16, 2022
@jscheffl jscheffl mentioned this pull request Sep 1, 2023
2 tasks
@jscheffl jscheffl deleted the feature/15783-auto-tail-file-logs-in-ui branch October 28, 2023 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logging area:providers area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues provider:amazon-aws AWS/Amazon - related issues provider:google Google (including GCP) related issues provider:microsoft-azure Azure-related issues type:new-feature Changelog: New Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-refresh of logs.
5 participants