This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Fixes WordPress/openverse#1751 by @mathemancer
Description
This PR creates a simple DAG to delete log files from the local airflow filesystem. The DAG runs daily. It checks the date of files in the airflow base log directory (in our case
/usr/local/airflow/logs
) and deletes everything created X days ago.This, paired with our new remote logging (#136), eliminates the need to manually delete airflow logs and worry about the scary-sounding work outlined here. We can delete that document after merging (or simply mark it deprecated/private).
Improvements are welcomed, encouraged, and needed! All I really did was copy/paste and test, I don't currently have the bandwidth to improve this further. It'd be great for the code style to be cleaned and altered to match the rest of the repository.
Technical details
This DAG was copied from https://github.com/teamclairvoyant/airflow-maintenance-dags/blob/master/log-cleanup/airflow-log-cleanup.py, the only edits made were to the default parameters.
Tests
If you'd like to test, you can do so locally by creating some random files in the log directory, and doing a manual DAG run with the configuration
{"maxLogAgeInDays":-1}
.Screenshots
Checklist
Update index.md
).main
ormaster
).Developer Certificate of Origin
Developer Certificate of Origin