client
client
¶
Async Unix domain socket client for Marianne daemon IPC.
Provides DaemonClient with two call patterns:
call(method, params): send a JSON-RPC request, await a single response. Uses aConnectionPoolto reuse connections across calls.stream(method, params): send a request, yield streaming notifications, and return the final result when the stream ends.
Plus typed convenience methods (status, submit_job, etc.) that wrap
call with Pydantic model serialization for type safety at the CLI layer.
Attributes¶
Classes¶
ConnectionPool
¶
ConnectionPool(socket_path, *, max_size=_DEFAULT_POOL_SIZE, max_idle_seconds=_DEFAULT_MAX_IDLE_SECONDS, connect_timeout=_DEFAULT_CONNECT_TIMEOUT, acquire_timeout=30.0)
LIFO connection pool for Unix domain sockets.
Internal implementation detail — not exported. Manages a bounded set
of reusable (reader, writer) pairs so DaemonClient.call() does
not pay the cost of opening a fresh socket for every RPC.
Parameters¶
socket_path: Unix domain socket to connect to. max_size: Maximum number of connections (checked-out + idle combined). max_idle_seconds: Connections idle longer than this are discarded on next acquire. connect_timeout: Seconds to wait when opening a new connection. acquire_timeout: Seconds to wait for the pool semaphore when all slots are busy.
Source code in src/marianne/daemon/ipc/client.py
Attributes¶
Methods:¶
acquire
async
¶
Acquire a connection from the pool.
Tries idle connections first (LIFO), skipping stale or broken ones. Opens a new connection if no idle connection is available.
Raises:
| Type | Description |
|---|---|
DaemonNotRunningError
|
if the pool is closed or connection fails. |
TimeoutError
|
if the pool semaphore cannot be acquired in time. |
Source code in src/marianne/daemon/ipc/client.py
release
¶
Return a healthy connection to the idle stack.
Source code in src/marianne/daemon/ipc/client.py
discard
¶
Discard a checked-out connection and return its slot once.
Source code in src/marianne/daemon/ipc/client.py
close
async
¶
Close idle and checked-out connections and wake waiting callers.
Source code in src/marianne/daemon/ipc/client.py
DaemonClient
¶
Async client for the Marianne daemon Unix socket IPC.
Parameters¶
socket_path:
Path to the Unix domain socket created by DaemonServer.
timeout:
Seconds to wait for a response before raising TimeoutError.
pool_size:
Maximum number of pooled connections for call().
Source code in src/marianne/daemon/ipc/client.py
Methods:¶
close
async
¶
call
async
¶
Send an RPC; retry transport failures only for known safe reads.
A timeout never retries: the daemon may still be doing the operation. Cancellation and corrupt responses discard the connection, preventing late replies from contaminating the next request.
Source code in src/marianne/daemon/ipc/client.py
stream
async
¶
Send a JSON-RPC request and yield streaming notifications.
Notifications (no id) are yielded as dicts. The final
response (with id) terminates the iteration.
If the final response contains an error, raises the
corresponding DaemonError.
Source code in src/marianne/daemon/ipc/client.py
is_daemon_running
async
¶
Check if daemon is running by performing a lightweight health RPC.
Uses a dedicated connection with a short deadline. Missing/refused sockets return False; an endpoint that accepts but does not respond raises DaemonUnresponsiveError, preserving the difference from absence.
Source code in src/marianne/daemon/ipc/client.py
status
async
¶
register_schedule
async
¶
Request daemon-side recurring registration and accepted digest.
Source code in src/marianne/daemon/ipc/client.py
current_schedule
async
¶
Read only the venue and schedule bound by an accepted receipt.
Source code in src/marianne/daemon/ipc/client.py
cancel_schedule
async
¶
Cancel one bound schedule; never retry a lost mutation response.
Source code in src/marianne/daemon/ipc/client.py
register_schedule_v2
async
¶
Request a daemon-minted receipt for caller-owned durable custody.
Source code in src/marianne/daemon/ipc/client.py
submit_job
async
¶
get_job_status
async
¶
Get status of a specific job.
pause_job
async
¶
Pause a running job. Returns {"paused": bool}.
Source code in src/marianne/daemon/ipc/client.py
resume_job
async
¶
Resume a paused job. Returns a JobResponse dict.
Source code in src/marianne/daemon/ipc/client.py
cancel_job
async
¶
Cancel a running or paused job. Returns {"cancelled": bool}.
Source code in src/marianne/daemon/ipc/client.py
list_jobs
async
¶
clear_jobs
async
¶
Clear terminal jobs from the daemon registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
statuses
|
list[str] | None
|
Status filter (defaults to terminal statuses). |
None
|
older_than_seconds
|
float | None
|
Only clear jobs older than this. |
None
|
job_ids
|
list[str] | None
|
Only clear these specific job IDs. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with "deleted" count. |
Source code in src/marianne/daemon/ipc/client.py
config
async
¶
reload_config
async
¶
Trigger the conductor's single config reload path (#408).
Not in _SAFE_RETRY_METHODS: a reload is a mutation, so a
response lost after send has an unknown outcome and is never
blindly retried.
Source code in src/marianne/daemon/ipc/client.py
health
async
¶
Liveness probe independent of busy pooled request connections.
Source code in src/marianne/daemon/ipc/client.py
readiness
async
¶
get_errors
async
¶
Get errors for a specific job.
Source code in src/marianne/daemon/ipc/client.py
diagnose
async
¶
Get diagnostic data for a specific job.
Source code in src/marianne/daemon/ipc/client.py
get_execution_history
async
¶
Get execution history for a specific job.
Source code in src/marianne/daemon/ipc/client.py
recover_job
async
¶
Request recovery data for a specific job.
Source code in src/marianne/daemon/ipc/client.py
rate_limits
async
¶
learning_patterns
async
¶
Get recent learning patterns from the global store.