Skip to content

Add maintenance.py for K8s CronJob scheduling - #22

Merged
jghoman merged 2 commits into
mainfrom
feat/add-maintenance-script-for-cron
Mar 27, 2026
Merged

jghoman merged 2 commits into
mainfrom
feat/add-maintenance-script-for-cron

Conversation

@jghoman

@jghoman jghoman commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Self-contained tools/maintenance.py replaces inline DuckDB CLI calls in tools/justfile with native Python duckdb, reusing the same env vars and Docker image
  • Pushes maintenance_start_time (immediately on start) and maintenance_duration_seconds (on completion) to Prometheus Pushgateway when PUSHGATEWAY_URL is set, enabling Grafana annotation queries for maintenance windows
  • Defaults S3 endpoint/ssl/url_style to match the old justfile behavior when env vars are unset
  • Rejects --days < 1 to prevent accidental full expiry/deletion
  • Justfile recipes delegate to the script; shell and drop remain as DuckDB CLI calls
  • Fixes missing INSTALL for DuckDB CLI extensions in justfile _setup

Test plan

  • Run python tools/maintenance.py --help and verify all subcommands listed
  • Run python tools/maintenance.py maintain --days 0 and verify it errors
  • Run python tools/maintenance.py maintain --days 7 --dry-run against a DuckLake instance
  • Verify just maintain-dry-run 3 delegates correctly
  • Verify just shell works (INSTALL + LOAD extensions)
  • Build Docker image and verify /app/tools/maintenance.py is present
  • Set PUSHGATEWAY_URL and verify metrics are pushed on start and completion
  • Unset PUSHGATEWAY_URL and verify no errors or log noise

jghoman added 2 commits March 26, 2026 17:40
Self-contained tools/maintenance.py replaces inline DuckDB CLI calls
with native Python duckdb, reusing the same env vars. Justfile recipes
now delegate to the script. Also fixes missing INSTALL for DuckDB CLI
extensions in the justfile shell setup.
Push maintenance_start_time on start and maintenance_duration_seconds on
completion via PUSHGATEWAY_URL. Default S3 endpoint/ssl/url_style to
match the old justfile when env vars are unset. Reject --days < 1 to
prevent accidental full expiry. Update README and AGENT.md.
@jghoman
jghoman merged commit d68af4f into main Mar 27, 2026
14 checks passed
@jghoman
jghoman deleted the feat/add-maintenance-script-for-cron branch March 27, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant