Entry points¶
create_quelware_client ¶
create_quelware_client(
endpoint="localhost",
port=50051,
session_agent=None,
configuration_agent=None,
health_agent_factory=None,
resource_agent_factory=None,
instrument_agent_factory=None,
diagnostics_agent_factory=None,
worker_agent_factory=None,
pat=None,
)
Create a client connected to a QuEL system over gRPC.
Opens a gRPC channel to endpoint:port and builds the default per-unit
agents. The returned client should be used as an async context manager so
the channel is closed on exit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
str
|
Host of the control server. |
'localhost'
|
port
|
int
|
Port of the control server. |
50051
|
session_agent
|
SessionAgent | None
|
Override for the session agent. Defaults to a gRPC agent targeting the central server. |
None
|
configuration_agent
|
SystemConfigurationAgent | None
|
Override for the system-configuration agent. Defaults to a gRPC agent targeting the central server. |
None
|
health_agent_factory
|
AgentFactory[HealthAgent] | None
|
Override for the per-unit health agent factory. When omitted, health checks run against a default agent. |
None
|
resource_agent_factory
|
AgentFactory[ResourceAgent] | None
|
Override for the per-unit resource agent factory. |
None
|
instrument_agent_factory
|
AgentFactory[InstrumentAgent] | None
|
Override for the per-unit instrument agent factory. |
None
|
diagnostics_agent_factory
|
AgentFactory[DiagnosticsAgent] | None
|
Override for the per-unit diagnostics agent factory. |
None
|
worker_agent_factory
|
AgentFactory[WorkerAgent] | None
|
Override for the per-unit worker agent factory. |
None
|
pat
|
PatProvider | str | None
|
Personal Access Token used to authenticate. May be the token
string, a callable returning it, or None to load it from the
configuration file ( |
None
|
Returns:
| Type | Description |
|---|---|
QuelwareClient
|
A configured, not-yet-started |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in quelware-client/src/quelware_client/client/_grpc.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
create_standalone_client ¶
create_standalone_client(
endpoint="localhost",
port=50051,
unit_label="mock-unit",
skip_lock_check=True,
pat=None,
)
Create a client that talks directly to a single worker server.
Intended for testing. The session and system-configuration agents are
mocked (a single unit, always ACTIVE), while the resource, instrument,
diagnostics, and worker agents connect over gRPC to endpoint:port. The
target worker server must be running with lock checking disabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
str
|
Host of the worker server. |
'localhost'
|
port
|
int
|
Port of the worker server. |
50051
|
unit_label
|
str
|
Label to assign to the single mocked unit. |
'mock-unit'
|
skip_lock_check
|
bool
|
When True (the default), sessions skip verifying that their resources are locked. |
True
|
pat
|
PatProvider | str | None
|
Personal Access Token, as accepted by |
None
|
Returns:
| Type | Description |
|---|---|
QuelwareClient
|
A configured, not-yet-started |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |