Add LOG_MAX_SIZE environment variables to log groomer#61559
Add LOG_MAX_SIZE environment variables to log groomer#61559potiuk merged 4 commits intoapache:mainfrom
Conversation
|
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 Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
807d65e to
da82a1e
Compare
|
I suspect the test failures are due to the following recently fixed issue. I've rebased off latest main branch. |
|
Nice ! |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…ache#61559) * Add LOG_MAX_SIZE_BYTES option to log cleaner * Updated clean logs * Charts updated and tests passing * Linting fixes (cherry picked from commit 1e5f789) Co-authored-by: Philip Corliss <pcorliss@gmail.com>
| fi | ||
| fi | ||
|
|
||
| find "${DIRECTORY}"/logs -type d -empty -delete || true |
There was a problem hiding this comment.
L65 should be executed before L54
There was a problem hiding this comment.
Hello @n-badtke-cg , I don't quite see the logic bug you're referring to, could you elaborate?
The way I think it works is the following but perhaps I've missed something.
- Delete log files based on retention days
- If Max size is set and size exceed max size reduce retention days by 1 and go to step 1, otherwise go to step 3.
- Delete empty log directories
- Sleep
There was a problem hiding this comment.
Hello @n-badtke-cg , I don't quite see the logic bug you're referring to, could you elaborate?
The way I think it works is the following but perhaps I've missed something.
- Delete log files based on retention days
- If Max size is set and size exceed max size reduce retention days by 1 and go to step 1, otherwise go to step 3.
- Delete empty log directories
- Sleep
I guess you are referring to an old message by me "found a logical bug" that was a false message by me, sorry for that!
And also with this message, I just misinterpret the code, sorry. It's actually kinda nice. It's reducing the retention time temporarily to free up more space in specific situations when needed. After the retention period has been temporarily shortened and storage space freed up, the retention period is reset to the env value.
Fair. Again sorry for the unnecessary messages.
* Add LOG_MAX_SIZE_BYTES option to log cleaner * Updated clean logs * Charts updated and tests passing * Linting fixes
* Add LOG_MAX_SIZE_BYTES option to log cleaner * Updated clean logs * Charts updated and tests passing * Linting fixes
* Add LOG_MAX_SIZE_BYTES option to log cleaner * Updated clean logs * Charts updated and tests passing * Linting fixes
* Add LOG_MAX_SIZE_BYTES option to log cleaner * Updated clean logs * Charts updated and tests passing * Linting fixes
Adds two optional environment variables to the
clean-logs.shscript to to delete logs once aAIRFLOW__LOG_MAX_SIZE_PERCENTthreshold has been breached or aAIRFLOW__LOG_MAX_SIZE_BYTEShas been breached. If either environment variable is present and the threshold has been breached the retention days is reduced until the threshold is met and then resets. This makes it easier to avoid out of disk space issues.airflow-core/tests/unit/charts/log_groomer.pywas updated in parallel withhelm-tests/tests/chart_utils/log_groomer.pybut both files appear to be duplicates of one another. Removing theairflow-core/tests/unit/charts/log_groomer.pyfiles felt out of scope for this PR but I'm happy to delete it if it's no longer in use.Was generative AI tooling used to co-author this PR?
Generated-by: [Cursor + Claude Opus 4.5] following the guidelines
The code has been heavily modified after generation and has been reviewed by a human (me). Code has been tested in our local environment.