Skip to main content

namespaces.delete_job_status

Returns status for a namespace delete started by namespaces.delete. Poll until status is "completed" or "failed".
client.namespaces.delete_job_status(namespace_name: str, job_id: str) -> dict[str, Any]
API: GET /namespaces/{namespace_name}/delete-jobs/{job_id} — see Delete job status

Parameters

namespace_name
str
required
Namespace the delete job belongs to.
job_id
str
required
Job id returned from namespaces.delete.
Returns: dict[str, Any] — job progress (status, timestamps, errors). Raises: MoorchehApiError on non-2xx responses.

Examples

Poll Delete Job
import time
from moorcheh import MoorchehClient

with MoorchehClient("http://localhost:8080") as client:
    resp = client.namespaces.delete("my-documents")
    job_id = resp["job_id"]

    while True:
        job = client.namespaces.delete_job_status("my-documents", job_id)
        if job["status"] in ("completed", "failed"):
            break
        time.sleep(0.5)

    if job["status"] == "failed":
        print(job.get("last_error"))

Error Handling

Error Handling Example
from moorcheh import MoorchehClient, MoorchehApiError

with MoorchehClient("http://localhost:8080") as client:
    try:
        job = client.namespaces.delete_job_status("my-documents", job_id)
    except MoorchehApiError as e:
        print(e.status_code, e.body)  # 404 if job not found