opensafely-core / opensafely-core/opencodelists
Automated housekeeping
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 60
- Forks
- 16
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 17
Description
Why are we doing this?
There are some tasks it's useful to run periodically in production. We should automate these.
- Vacuuming a local copy of the core DB reduced its size by 15% (Slack thread) so doing so on the real server could reduce space used by the DB and its backups.
- Vacuuming coding system databases on creation https://github.com/opensafely-core/opencodelists/issues/2383
- There are thousands of expired Django sessions in the core DB (Slack thread). These don't take up a huge amount of space but it does gradually increase over time and is multiplied by the number of backups. (See Job Server clearsessions job).
- Applying Django management command
migrate --pruneremoves record of stale migrations from the DB and avoids any clashes after squashing migrations.
How will we know when it's done?
A cron or other mechanism for periodically automatically executing the tasks is operational.
What are we doing?
- Creating an automated housekeeping task that periodically (weekly? at night and not clashing with others such as backups?) addresses the above issues.
- Linking it to Sentry?
- Check whether any of these considerations apply in Job Server and if so raise an issue there.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Job Server clearsessions job and the Django management commands named in the issue, then examine how production database tasks and backups are scheduled. Clarify the mechanism, timing, Sentry integration, and whether Job Server needs a separate issue. Done means a periodic operational task runs the agreed housekeeping actions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- databases, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100