schrodinger.application.bunsen.ipc_client module¶
Local channels between Maestro and the Bunsen desktop app.
Two independent clients live here:
BunsenPresenceClientlets the Bunsen Maestro picker discover this Maestro. While the picker is open, Bunsen hosts a presence server whose randomly generated name it writes to a pointer file in the Schrodinger appdata directory. Maestro connects, announces its instance ID and state, and sends full metadata and screenshot snapshots over that socket. No screenshots are captured while the picker is closed.BunsenIPCClienthandles the handoff: it watches for a per-instance Unix socket (or Windows named pipe) that Bunsen creates when the user picks this Maestro, reads the session info, and optionally brokers a PAT.
- schrodinger.application.bunsen.ipc_client.generate_instance_id() str¶
- schrodinger.application.bunsen.ipc_client.get_project_path() str | None¶
Return the current Maestro project directory, or None.
- schrodinger.application.bunsen.ipc_client.now_utc() str¶
- class schrodinger.application.bunsen.ipc_client.BunsenPresenceClient(instance_id: str, started_at: str, connected: bool = False, parent=None)¶
Bases:
QObjectAnnounces this Maestro to the Bunsen Maestro picker.
Every second, while not connected, the pointer file Bunsen writes when the picker opens is checked. If it names a presence server, Maestro connects and sends a UTF-8 JSON snapshot with a fresh screenshot. Bunsen sends
SCREENSHOTto request a refresh. State changes send another full snapshot, reusing the last image. When the server goes away polling resumes.- __init__(instance_id: str, started_at: str, connected: bool = False, parent=None)¶
- Parameters:
instance_id – This Maestro’s instance ID.
started_at – When this Maestro started; orders the picker.
connected – Whether Maestro holds a Bunsen client.
- start() None¶
Begin watching for the Bunsen presence server.
- stop() None¶
Stop watching and drop any presence connection.
- setConnected(connected: bool) None¶
Record whether Maestro holds a Bunsen client and tell Bunsen.
- Parameters:
connected – True while connecting or connected to a session.
- class schrodinger.application.bunsen.ipc_client.BunsenIPCClient(instance_id: str | None = None, parent=None)¶
Bases:
QObjectWatches for Bunsen’s per-instance handoff socket.
Every few seconds a per-instance socket is checked. When the user picks this Maestro in Bunsen, Bunsen creates that socket; Maestro connects to it, reads the session info, and emits
sessionDiscovered.The socket stays open after
sessionDiscoveredso the service can, if the session needs auth and no valid token is available, ask the desktop app to broker a PAT:requestPatwritesREQUEST_PATand the reply (PAT <token>orPAT_ERROR <message>) drivespatReceived/patRequestFailed. The service callsfinishExchangeto close the socket once the handshake is done.- sessionDiscovered¶
A
pyqtSignalemitted by instances of the class.
- patReceived¶
A
pyqtSignalemitted by instances of the class.
- patRequestFailed¶
A
pyqtSignalemitted by instances of the class.
- __init__(instance_id: str | None = None, parent=None)¶
- start()¶
Begin probing for the handoff socket.
- stop()¶
Stop probing and close any open handoff socket.
- requestPat()¶
Ask the desktop app to broker a PAT over the open socket.
Emits
patReceivedon success orpatRequestFailedif the desktop app cannot mint one (or does not answer in time).
- finishExchange()¶
Close the desktop socket once the session/PAT handshake is done.