GoodMem
ReferenceClient SDKsPython

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

admin.drain(*, reason: str = None, timeout_sec: int = None, wait_for_quiesce: bool = None) -> AdminDrainResponse

Initiates drain mode and optionally waits for the server to quiesce.

Parameters
  • 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.
Returns

AdminDrainResponse — Returns the drain status.

Example
result = client.admin.drain(timeout_sec=0)
print(f"State: {result.state}, Quiesced: {result.quiesced}")


Purge completed background jobs

admin.background_jobs.purge(*, older_than: str, dry_run: bool = None, limit: int = None, statuses: list[str] = None) -> AdminPurgeJobsResponse

Deletes terminal background jobs older than a retention cutoff.

Parameters
  • 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.
Returns

AdminPurgeJobsResponse — Returns the count of purged jobs.

Example
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

admin.license.reload() -> AdminReloadLicenseResponse

Triggers the server to reload its license file from the configured directory and returns metadata about the currently active license.

Returns

AdminReloadLicenseResponse — Returns the reloaded license state.

Example
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_idownerId).

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.