Admin
Methods on this page are called as client.admin.<method>(...) where client is either a synchronous Goodmem or asynchronous AsyncGoodmem instance initialized below:
from goodmem import Goodmem
client = Goodmem(base_url='http://localhost:8080', api_key='gm_...')from goodmem import AsyncGoodmem
client = AsyncGoodmem(base_url='http://localhost:8080', api_key='gm_...')Request the server to enter drain mode
Initiates drain mode and optionally waits for the server to quiesce.
- reason (
str, optional) — Human-readable reason for initiating drain mode. - timeout_sec (
int, optional) — Maximum seconds to wait for the server to quiesce before returning. - wait_for_quiesce (
bool, optional) — If true, wait for in-flight requests to complete and the server to reach QUIESCED before responding.
AdminDrainResponse — Returns the drain status.
result = client.admin.drain(timeout_sec=0)
print(f"State: {result.state}, Quiesced: {result.quiesced}")Purge completed background jobs
Deletes terminal background jobs older than a retention cutoff.
- older_than (
str) — ISO-8601 timestamp cutoff; only terminal jobs older than this instant are eligible. - dry_run (
bool, optional) — If true, report purge counts without deleting any rows. - limit (
int, optional) — Maximum number of jobs to purge in this request. - statuses (
list[str], optional) — Optional terminal background job statuses to target for purging.
AdminPurgeJobsResponse — Returns the count of purged jobs.
result = client.admin.background_jobs.purge(older_than="2000-01-01T00:00:00Z", dry_run=True)
print(f"Jobs purged: {result.jobs_purged}")Reload the active license from disk
Triggers the server to reload its license file from the configured directory and returns metadata about the currently active license.
AdminReloadLicenseResponse — Returns the reloaded license state.
result = client.admin.license.reload()
print(f"License status: {result.status}")Async usage: client.admin exposes the same methods on AsyncGoodmem; use await / async for as needed.
Data Models
All data models are pydantic v2 models. Fields are shown with their Python attribute names; JSON responses use camelCase aliases (e.g., owner_id → ownerId).
AdminDrainResponse
AdminDrainResponse
- state (
str, optional) — Lifecycle state reported after the drain request was processed. - quiesced (
bool) — Whether the server has reached the QUIESCED lifecycle state. - message (
str, optional) — Human-readable status message describing the drain outcome.
AdminPurgeJobsResponse
AdminPurgeJobsResponse
- jobs_purged (
int) — Number of background job rows removed, or that would be removed during dry-run. - attempts_purged (
int) — Number of background job attempt rows removed. - references_purged (
int) — Number of background job reference rows removed. - dry_run (
bool) — Whether the purge executed in dry-run mode.
AdminReloadLicenseResponse
AdminReloadLicenseResponse
- status (
str, optional) — Outcome of the reload attempt, such as LOADED, UNCHANGED, FAILED, or NOT_FOUND. - message (
str, optional) — Human-readable message describing the reload result. - active_license (
ActiveLicenseMetadata, optional) — Metadata for the currently active license after reload, or null if no license is active.
ActiveLicenseMetadata
ActiveLicenseMetadata
- filename (
str, optional) — Filename of the active license on disk. - sha256 (
str, optional) — Hex-encoded SHA-256 hash of the active license file. - size_bytes (
int) — Size of the active license file in bytes. - modified_at (
str, optional) — Last modification timestamp of the active license file.