client
tit.jobs.client ¶
Notebook client for tit.jobs (TODO.md §2.3): submit into the same queue the desktop
app uses, over the local server's HTTP API — so a notebook and the GUI never race on the same
resource without the scheduler knowing about both.
Talks to tit.server over plain HTTP (stdlib urllib, no new dependency); defaults come
from the same environment variables the server itself uses (TIT_SERVER_URL,
TIT_SERVER_TOKEN) so a notebook started alongside NOTEBOOK in-container needs no extra
configuration.
JobClientError ¶
Bases: RuntimeError
An HTTP call to tit.server failed (non-2xx, or the server is unreachable).
submit ¶
submit(kind: str, config: dict[str, Any], subject_ids: list[str], *, after: list[str] | None = None, tags: list[str] | None = None, overwrite: bool = False, base_url: str | None = None, token: str | None = None) -> dict[str, Any]
POST /api/jobs; returns the JobStatus dict.
Source code in tit/jobs/client.py
get ¶
GET /api/jobs/{id}; returns the JobDetail dict (spec/status/artifacts).
Source code in tit/jobs/client.py
watch ¶
watch(job_id: str, *, base_url: str | None = None, token: str | None = None, poll_interval: float = 1.0, print_events: bool = True) -> dict[str, Any]
Poll /api/jobs/{id}/events until job_id reaches a terminal state.
Prints log/stage events as they arrive when print_events is true (the notebook
equivalent of watching the Jobs panel). Returns the final JobStatus dict.
Source code in tit/jobs/client.py
run_from_json ¶
run_from_json(spec_path: str, *, base_url: str | None = None, token: str | None = None, poll_interval: float = 1.0, print_events: bool = True) -> dict[str, Any]
Read a spec.json ({kind, config, subject_ids, after?, tags?, overwrite?}), submit
it, and block until it finishes. Returns the final JobStatus dict.