Skip to content

feat(remove-outputs): tag-scoped retention for limit and age #313

Open
timdegroot1996 wants to merge 1 commit into
mainfrom
remove-outputs-with-tag
Open

feat(remove-outputs): tag-scoped retention for limit and age #313
timdegroot1996 wants to merge 1 commit into
mainfrom
remove-outputs-with-tag

Conversation

@timdegroot1996

Copy link
Copy Markdown
Collaborator

Implements #309

Make limit and age respect a tags filter so housekeeping can be scoped to a subset of runs instead of acting globally:

  • limit + tags -> keep the N newest runs carrying any of the given tag(s), remove older matching runs, leave untagged runs untouched.
  • age + tags -> remove only tagged runs within the age range, leave untagged runs untouched (supports both older 10d and younger -10d).

CLI combination syntax uses the regular comma separator, e.g. -r "limit=10,tag=nightly" / -r "age=10d,tag=nightly,tag=prod". arguments.py detects the combination, validates it, and rewrites it into the internal limit=N;tag=... / age=X;tag=... form (the legacy ; form still works). Rules:

  • tags may combine with EITHER limit OR age, not both (error).
  • only one limit/age may be combined with tags (error).
  • a clear INFO line explains exactly what will be deleted; when independent options (index/alias/run_start) are also present the deletion order is printed.

Server /remove-outputs scopes the same way when tags is sent with limit and/or age, and rejects the limit+age+tags combination before removing anything.

Backward compatible: plain limit/age/tag (no partner) behave exactly as before; the elif dispatch in database.py is reordered so combined queries route to the scoped handler.

Docs (CLI + server), OpenAPI examples, and the admin UI labels updated. Also documents the previously under-documented negative-age (-10d) behavior in the docs.

)

Make `limit` and `age` respect a `tags` filter so housekeeping can be
scoped to a subset of runs instead of acting globally:

- limit + tags -> keep the N newest runs carrying any of the given tag(s),
  remove older matching runs, leave untagged runs untouched.
- age + tags -> remove only tagged runs within the age range, leave
  untagged runs untouched (supports both older `10d` and younger `-10d`).

CLI combination syntax uses the regular comma separator, e.g.
`-r "limit=10,tag=nightly"` / `-r "age=10d,tag=nightly,tag=prod"`.
arguments.py detects the combination, validates it, and rewrites it into
the internal `limit=N;tag=...` / `age=X;tag=...` form (the legacy `;`
form still works). Rules:
- tags may combine with EITHER limit OR age, not both (error).
- only one limit/age may be combined with tags (error).
- a clear INFO line explains exactly what will be deleted; when
  independent options (index/alias/run_start) are also present the
  deletion order is printed.

Server `/remove-outputs` scopes the same way when `tags` is sent with
`limit` and/or `age`, and rejects the limit+age+tags combination before
removing anything.

Backward compatible: plain limit/age/tag (no partner) behave exactly as
before; the elif dispatch in database.py is reordered so combined queries
route to the scoped handler.

Docs (CLI + server), OpenAPI examples, and the admin UI labels updated.
Also documents the previously under-documented negative-age (`-10d`)
behavior in the docs.
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.

[Improvement] Add retention helper to /remove-outputs: keep N newest runs within a tag

1 participant