VirtualClient
For conceptual usage, see:
- class pyrogue.interfaces.VirtualClient(addr='localhost', port=9099, linkTimeout=None, requestStallTimeout=None)[source]
A full featured client interface for Rogue. This can be used in scripts or other clients which require remote access to the running Rogue instance.
This class ues a custom factory ensuring that only one instance of this class is created in a python script for a given remote connection.
- Parameters:
addr (
str, default:'localhost') – host addressport (
int, default:9099) – host portlinkTimeout (
float|None, default:None) – Idle timeout in seconds before the client marks the link down when no publish updates or successful replies have been observed. This is the primary operational timeout knob for both hardware and simulation applications.requestStallTimeout (
float|None, default:None) – Optional policy timeout for how long a single in-flight request may remain outstanding before the client declares the connection stalled. This is disabled by default and is typically only useful when a deployment has a well-defined upper bound for legitimate request time.
- Variables:
linked (bool) – link state
root (obj) – root class reference
- Return type:
- addLinkMonitor(function)[source]
Add a link monitor callback function. This function will be called any time the link state changes. A single boolean argument will be passed to the callback function containing the current link state.
- property requestStallTimeout: float | None
Optional maximum in-flight request age before it is treated as stalled.
- setTimeoutConfig(*, linkTimeout=None, requestStallTimeout=None)[source]
Update link and request-stall timeout settings.
linkTimeoutis the normal tuning knob for clients that need to tolerate longer busy periods.requestStallTimeoutis an optional policy threshold and is most useful only when a deployment has a clear, finite upper bound for legitimate request duration.
- stopMonitor()[source]
Stop the link-monitor thread without releasing ZMQ resources.
Use this when a long-lived client must drop link-heartbeat polling but the ZMQ transport must remain open. The intended caller is a host script that hands a
VirtualClientto an interactive wrapper (for examplepysmurf) and wants to silence the monitor on shutdown without losing the connection.stop()is the wrong choice for that case because it also closes the C++ZmqClientsockets and removes the instance fromClientCache.After
stopMonitor()returns the client still services_remoteAttrcalls and SUB publish updates; only the periodic link-state heartbeat is disabled. Idempotent; safe to call from any thread other than_monThreaditself.- Return type:
- stop()[source]
Stop the monitor thread and release the underlying ZMQ resources.
After
stop()returns the C++ sockets and ZMQ context are released and this instance is removed fromClientCache; a subsequentVirtualClient(addr, port)therefore constructs a fresh, fully connected instance instead of returning the torn-down one.- Return type:
- property root: VirtualNode
Return the connected virtual root node.