plesty-bench 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plesty/bench/__init__.py +45 -0
- plesty/bench/cli.py +111 -0
- plesty/bench/client.py +242 -0
- plesty_bench-0.2.0.dist-info/METADATA +45 -0
- plesty_bench-0.2.0.dist-info/RECORD +9 -0
- plesty_bench-0.2.0.dist-info/WHEEL +4 -0
- plesty_bench-0.2.0.dist-info/entry_points.txt +2 -0
- plesty_bench-0.2.0.dist-info/licenses/LICENSE +184 -0
- plesty_bench-0.2.0.dist-info/licenses/LICENSES/LGPL-3.0-or-later.txt +165 -0
plesty/bench/__init__.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Yunshuang Yuan
|
|
2
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
"""``plesty.bench`` — talk to a bench running ``plesty-server`` from another machine.
|
|
5
|
+
|
|
6
|
+
This is the *client* half of plesty-server and the only part published to
|
|
7
|
+
PyPI (distribution ``plesty-bench``). It depends on ``pyzmq`` and ``click``
|
|
8
|
+
and imports nothing from ``plesty.server``: the developer machine that runs
|
|
9
|
+
the remote field-test loop, or a script on the experiment PC, installs this
|
|
10
|
+
and nothing of the bench application.
|
|
11
|
+
|
|
12
|
+
The contract is deliberately thin — *the CLI is the API*: the bench agent
|
|
13
|
+
accepts a ``plesty-server`` argument list, runs it, and returns the exit
|
|
14
|
+
code and the output. Anything the command line can do is remote, with no
|
|
15
|
+
second schema to keep in step.
|
|
16
|
+
|
|
17
|
+
.. code-block:: python
|
|
18
|
+
|
|
19
|
+
from plesty.bench import BenchClient
|
|
20
|
+
|
|
21
|
+
with BenchClient("tcp://lab-bench-03:5550", token="…") as bench:
|
|
22
|
+
print(bench.describe()["result"]["version"])
|
|
23
|
+
result = bench.exec(["status", "--json"])
|
|
24
|
+
job = bench.exec(["field-test", "pm100d", "--no-wait"]).stdout.strip()
|
|
25
|
+
bench.follow(job, print) # tails the job log until it ends
|
|
26
|
+
data = bench.fetch("repos/plesty-pm100d/exp/reports/pm100d-s120c/field-test.json")
|
|
27
|
+
|
|
28
|
+
Or from a shell: ``plesty-bench -b lab-bench-03 -- status``.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
from plesty.bench.client import (
|
|
32
|
+
DEFAULT_PORT,
|
|
33
|
+
BenchClient,
|
|
34
|
+
BenchClientError,
|
|
35
|
+
ExecResult,
|
|
36
|
+
parse_address,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"DEFAULT_PORT",
|
|
41
|
+
"BenchClient",
|
|
42
|
+
"BenchClientError",
|
|
43
|
+
"ExecResult",
|
|
44
|
+
"parse_address",
|
|
45
|
+
]
|
plesty/bench/cli.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Yunshuang Yuan
|
|
2
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
"""``plesty-bench`` — run ``plesty-server`` commands on a remote bench.
|
|
5
|
+
|
|
6
|
+
.. code-block:: bash
|
|
7
|
+
|
|
8
|
+
plesty-bench -b lab-bench-03 status
|
|
9
|
+
plesty-bench -b lab-bench-03 field-test pm100d --address mock # follows the job
|
|
10
|
+
plesty-bench -b lab-bench-03 fetch repos/plesty-pm100d/exp/reports/<slug>/field-test.json -o .
|
|
11
|
+
plesty-bench -b lab-bench-03 ping
|
|
12
|
+
|
|
13
|
+
``-b`` (or ``PLESTY_BENCH``) names the bench, ``--token`` (or
|
|
14
|
+
``PLESTY_BENCH_TOKEN``) the shared secret. Everything else is handed to the
|
|
15
|
+
bench's ``plesty-server`` unchanged (put ``--`` first when the remote
|
|
16
|
+
arguments start with a dash). Two words are the client's own: ``ping`` and
|
|
17
|
+
``fetch PATH [-o OUT]``. When the remote command is one that starts a job
|
|
18
|
+
(``install``, ``update``, ``field-test``) it is started ``--no-wait`` on the
|
|
19
|
+
bench and its log is followed here until it ends.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import sys
|
|
25
|
+
from collections.abc import Sequence
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
|
|
28
|
+
import click
|
|
29
|
+
|
|
30
|
+
from plesty.bench.client import ADDRESS_ENV, TOKEN_ENV, BenchClient, BenchClientError
|
|
31
|
+
|
|
32
|
+
#: Remote commands that start a job; the client adds ``--no-wait`` and follows.
|
|
33
|
+
JOB_COMMANDS = ("install", "update", "field-test")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@click.command("plesty-bench", context_settings={"ignore_unknown_options": True})
|
|
37
|
+
@click.option("-b", "--bench", "address", envvar=ADDRESS_ENV, default=None, metavar="HOST[:PORT]")
|
|
38
|
+
@click.option("--token", envvar=TOKEN_ENV, default=None, help="Shared secret of the agent.")
|
|
39
|
+
@click.option("--timeout", type=float, default=60.0, show_default=True, help="Reply timeout (s).")
|
|
40
|
+
@click.argument("argv", nargs=-1, type=click.UNPROCESSED)
|
|
41
|
+
def app(address: str | None, token: str | None, timeout: float, argv: tuple[str, ...]) -> None:
|
|
42
|
+
"""Run `plesty-server ARGV` on the bench at -b; `ping` and `fetch PATH [-o OUT]` are local."""
|
|
43
|
+
client = BenchClient(address, token, timeout_ms=int(timeout * 1000))
|
|
44
|
+
args = [a for a in argv if a != "--"]
|
|
45
|
+
if not args:
|
|
46
|
+
click.echo(click.get_current_context().get_help())
|
|
47
|
+
return
|
|
48
|
+
try:
|
|
49
|
+
if args[0] == "ping":
|
|
50
|
+
info = client.describe(timeout_ms=3000)
|
|
51
|
+
kind, version, home = info.get("kind"), info.get("version"), info.get("home")
|
|
52
|
+
click.echo(f"{client.address}: {kind} {version} home={home}")
|
|
53
|
+
return
|
|
54
|
+
if args[0] == "fetch":
|
|
55
|
+
_fetch(client, args[1:])
|
|
56
|
+
return
|
|
57
|
+
raise click.exceptions.Exit(run_remote(client, args))
|
|
58
|
+
except BenchClientError as exc:
|
|
59
|
+
raise click.ClickException(str(exc)) from exc
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def run_remote(client: BenchClient, args: Sequence[str]) -> int:
|
|
63
|
+
"""Run *args* on the bench; follow the job when it starts one. Returns the exit code."""
|
|
64
|
+
argv = list(args)
|
|
65
|
+
follow = argv[0] in JOB_COMMANDS and "--no-wait" not in argv
|
|
66
|
+
if follow:
|
|
67
|
+
argv.append("--no-wait")
|
|
68
|
+
result = client.exec(argv)
|
|
69
|
+
if result.stderr:
|
|
70
|
+
click.echo(result.stderr, err=True, nl=False)
|
|
71
|
+
lines = result.stdout.strip().splitlines()
|
|
72
|
+
if not follow or not result.ok or not lines:
|
|
73
|
+
click.echo(result.stdout, nl=False)
|
|
74
|
+
return result.code
|
|
75
|
+
job_id = lines[-1]
|
|
76
|
+
click.echo(f"job {job_id}", err=True)
|
|
77
|
+
return client.follow(job_id, lambda text: click.echo(text, nl=False))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _fetch(client: BenchClient, args: Sequence[str]) -> None:
|
|
81
|
+
rest = list(args)
|
|
82
|
+
out: str | None = None
|
|
83
|
+
for flag in ("-o", "--out"):
|
|
84
|
+
if flag in rest:
|
|
85
|
+
i = rest.index(flag)
|
|
86
|
+
if i + 1 >= len(rest):
|
|
87
|
+
raise click.ClickException(f"{flag} needs a path")
|
|
88
|
+
out = rest[i + 1]
|
|
89
|
+
del rest[i : i + 2]
|
|
90
|
+
if len(rest) != 1:
|
|
91
|
+
raise click.ClickException("fetch PATH [-o OUT]")
|
|
92
|
+
data = client.fetch(rest[0])
|
|
93
|
+
if out is None:
|
|
94
|
+
sys.stdout.buffer.write(data)
|
|
95
|
+
sys.stdout.flush()
|
|
96
|
+
return
|
|
97
|
+
target = Path(out)
|
|
98
|
+
if target.is_dir():
|
|
99
|
+
target = target / Path(rest[0]).name
|
|
100
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
101
|
+
target.write_bytes(data)
|
|
102
|
+
click.echo(f"wrote {target} ({len(data)} bytes)")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def main() -> None:
|
|
106
|
+
"""Console-script entry point."""
|
|
107
|
+
app(prog_name="plesty-bench")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
if __name__ == "__main__": # pragma: no cover
|
|
111
|
+
main()
|
plesty/bench/client.py
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Yunshuang Yuan
|
|
2
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
"""The bench client: one ZMQ DEALER socket, three request types.
|
|
5
|
+
|
|
6
|
+
The wire is the plesty-lib device-server wire — JSON frames, ``status: ok``
|
|
7
|
+
or ``status: error`` replies — so a :func:`plesty.lib.service.build_client`
|
|
8
|
+
or a ``describe`` probe understands the agent too. Requests:
|
|
9
|
+
|
|
10
|
+
``{"type": "describe"}``
|
|
11
|
+
→ ``{"status": "ok", "result": {"kind": "plesty-server-agent", "version": …,
|
|
12
|
+
"home": …, "commands": [...]}}``
|
|
13
|
+
``{"type": "exec", "argv": [...], "token": "…"}``
|
|
14
|
+
→ ``{"status": "ok", "result": {"code": 0, "stdout": "…", "stderr": "…"}}``
|
|
15
|
+
``{"type": "fetch", "path": "relative/to/home", "token": "…"}``
|
|
16
|
+
→ ``{"status": "ok", "result": {"path": …, "size": n, "data": "<base64>"}}``
|
|
17
|
+
|
|
18
|
+
Everything long-running is already a job on the bench: ask for it with
|
|
19
|
+
``--no-wait``, then :meth:`BenchClient.follow` the job log.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import base64
|
|
25
|
+
import json
|
|
26
|
+
import os
|
|
27
|
+
import time
|
|
28
|
+
from collections.abc import Callable, Sequence
|
|
29
|
+
from dataclasses import dataclass
|
|
30
|
+
from typing import Any
|
|
31
|
+
|
|
32
|
+
import zmq
|
|
33
|
+
|
|
34
|
+
#: The agent's port; device servers are given 5551 upwards.
|
|
35
|
+
DEFAULT_PORT = 5550
|
|
36
|
+
|
|
37
|
+
#: Environment variables the client reads when no address/token is given.
|
|
38
|
+
ADDRESS_ENV = "PLESTY_BENCH"
|
|
39
|
+
TOKEN_ENV = "PLESTY_BENCH_TOKEN"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class BenchClientError(RuntimeError):
|
|
43
|
+
"""The bench did not answer, refused the request, or the command failed to run."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class ExecResult:
|
|
48
|
+
"""What one remote ``plesty-server`` invocation produced.
|
|
49
|
+
|
|
50
|
+
Attributes:
|
|
51
|
+
argv: The arguments that were run.
|
|
52
|
+
code: Exit code.
|
|
53
|
+
stdout: Captured standard output.
|
|
54
|
+
stderr: Captured standard error (progress lines).
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
argv: tuple[str, ...]
|
|
58
|
+
code: int
|
|
59
|
+
stdout: str
|
|
60
|
+
stderr: str
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def ok(self) -> bool:
|
|
64
|
+
"""Whether the command exited 0."""
|
|
65
|
+
return self.code == 0
|
|
66
|
+
|
|
67
|
+
def json(self) -> Any:
|
|
68
|
+
"""Parse stdout as JSON (for commands run with ``--json``)."""
|
|
69
|
+
return json.loads(self.stdout)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def parse_address(value: str | None) -> str:
|
|
73
|
+
"""Turn ``host``, ``host:port`` or ``tcp://host:port`` into a ZMQ endpoint.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
value: The address; ``None`` reads ``PLESTY_BENCH``, else ``localhost``.
|
|
77
|
+
"""
|
|
78
|
+
raw = (value or os.environ.get(ADDRESS_ENV) or "localhost").strip()
|
|
79
|
+
if "://" in raw:
|
|
80
|
+
return raw
|
|
81
|
+
host, _, port = raw.rpartition(":")
|
|
82
|
+
if not host:
|
|
83
|
+
host, port = raw, str(DEFAULT_PORT)
|
|
84
|
+
return f"tcp://{host}:{port or DEFAULT_PORT}"
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class BenchClient:
|
|
88
|
+
"""A connection to one bench agent."""
|
|
89
|
+
|
|
90
|
+
def __init__(
|
|
91
|
+
self,
|
|
92
|
+
address: str | None = None,
|
|
93
|
+
token: str | None = None,
|
|
94
|
+
timeout_ms: int = 10000,
|
|
95
|
+
context: zmq.Context[Any] | None = None,
|
|
96
|
+
) -> None:
|
|
97
|
+
"""Connect lazily to *address*.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
address: ``host``, ``host:port`` or ``tcp://host:port``; ``None``
|
|
101
|
+
reads ``PLESTY_BENCH``.
|
|
102
|
+
token: Shared secret the agent was started with; ``None`` reads
|
|
103
|
+
``PLESTY_BENCH_TOKEN``.
|
|
104
|
+
timeout_ms: Default reply timeout for :meth:`request`.
|
|
105
|
+
context: ZMQ context to use; the global instance by default.
|
|
106
|
+
"""
|
|
107
|
+
self.address = parse_address(address)
|
|
108
|
+
self.token = token if token is not None else os.environ.get(TOKEN_ENV)
|
|
109
|
+
self.timeout_ms = timeout_ms
|
|
110
|
+
self._context = context or zmq.Context.instance()
|
|
111
|
+
self._socket: zmq.Socket[Any] | None = None
|
|
112
|
+
|
|
113
|
+
# ── lifecycle ────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
def __enter__(self) -> BenchClient:
|
|
116
|
+
"""Open the socket."""
|
|
117
|
+
self._connect()
|
|
118
|
+
return self
|
|
119
|
+
|
|
120
|
+
def __exit__(self, *_exc: object) -> None:
|
|
121
|
+
"""Close the socket."""
|
|
122
|
+
self.close()
|
|
123
|
+
|
|
124
|
+
def close(self) -> None:
|
|
125
|
+
"""Close the socket (a later request reconnects)."""
|
|
126
|
+
if self._socket is not None:
|
|
127
|
+
self._socket.close(linger=0)
|
|
128
|
+
self._socket = None
|
|
129
|
+
|
|
130
|
+
def _connect(self) -> zmq.Socket[Any]:
|
|
131
|
+
if self._socket is None:
|
|
132
|
+
sock = self._context.socket(zmq.DEALER)
|
|
133
|
+
sock.setsockopt(zmq.LINGER, 0)
|
|
134
|
+
sock.connect(self.address)
|
|
135
|
+
self._socket = sock
|
|
136
|
+
return self._socket
|
|
137
|
+
|
|
138
|
+
# ── wire ─────────────────────────────────────────────────────────────
|
|
139
|
+
|
|
140
|
+
def request(self, message: dict[str, Any], timeout_ms: int | None = None) -> dict[str, Any]:
|
|
141
|
+
"""Send one request and return the ``result`` of an ``ok`` reply.
|
|
142
|
+
|
|
143
|
+
Raises:
|
|
144
|
+
BenchClientError: On no reply in time, a malformed reply, or an
|
|
145
|
+
``error`` reply (its message is the exception text).
|
|
146
|
+
"""
|
|
147
|
+
sock = self._connect()
|
|
148
|
+
payload = dict(message)
|
|
149
|
+
if self.token and "token" not in payload:
|
|
150
|
+
payload["token"] = self.token
|
|
151
|
+
wait = self.timeout_ms if timeout_ms is None else timeout_ms
|
|
152
|
+
try:
|
|
153
|
+
sock.send(json.dumps(payload).encode())
|
|
154
|
+
if not sock.poll(wait, zmq.POLLIN):
|
|
155
|
+
# A DEALER keeps the unanswered frame queued; drop the socket so a
|
|
156
|
+
# retry is not answered by the stale request's reply.
|
|
157
|
+
self.close()
|
|
158
|
+
raise BenchClientError(f"no reply from {self.address} in {wait} ms")
|
|
159
|
+
reply = json.loads(sock.recv().decode("utf-8", errors="replace"))
|
|
160
|
+
except zmq.ZMQError as exc:
|
|
161
|
+
self.close()
|
|
162
|
+
raise BenchClientError(f"{self.address}: {exc}") from exc
|
|
163
|
+
except ValueError as exc:
|
|
164
|
+
raise BenchClientError(f"{self.address}: reply was not JSON ({exc})") from exc
|
|
165
|
+
if not isinstance(reply, dict):
|
|
166
|
+
raise BenchClientError(f"{self.address}: reply was not a JSON object")
|
|
167
|
+
if reply.get("status") != "ok":
|
|
168
|
+
raise BenchClientError(str(reply.get("error") or reply))
|
|
169
|
+
result = reply.get("result")
|
|
170
|
+
return result if isinstance(result, dict) else {"value": result}
|
|
171
|
+
|
|
172
|
+
# ── the three requests ───────────────────────────────────────────────
|
|
173
|
+
|
|
174
|
+
def describe(self, timeout_ms: int | None = None) -> dict[str, Any]:
|
|
175
|
+
"""The agent's self-description (kind, version, home, commands)."""
|
|
176
|
+
return self.request({"type": "describe"}, timeout_ms)
|
|
177
|
+
|
|
178
|
+
def ping(self, timeout_ms: int = 2000) -> bool:
|
|
179
|
+
"""Whether a bench agent answers at the address."""
|
|
180
|
+
try:
|
|
181
|
+
return self.describe(timeout_ms).get("kind") == "plesty-server-agent"
|
|
182
|
+
except BenchClientError:
|
|
183
|
+
return False
|
|
184
|
+
|
|
185
|
+
def exec(self, argv: Sequence[str], timeout_ms: int | None = None) -> ExecResult:
|
|
186
|
+
"""Run ``plesty-server <argv>`` on the bench and return what it produced.
|
|
187
|
+
|
|
188
|
+
The result carries the exit code; it does not raise on a non-zero
|
|
189
|
+
exit, only when the agent could not run the command at all.
|
|
190
|
+
"""
|
|
191
|
+
result = self.request(
|
|
192
|
+
{"type": "exec", "argv": [str(a) for a in argv]},
|
|
193
|
+
self.timeout_ms if timeout_ms is None else timeout_ms,
|
|
194
|
+
)
|
|
195
|
+
return ExecResult(
|
|
196
|
+
argv=tuple(str(a) for a in argv),
|
|
197
|
+
code=int(result.get("code", -1)),
|
|
198
|
+
stdout=str(result.get("stdout", "")),
|
|
199
|
+
stderr=str(result.get("stderr", "")),
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def fetch(self, path: str, timeout_ms: int | None = None) -> bytes:
|
|
203
|
+
"""Download a file from the bench home (``path`` relative to it)."""
|
|
204
|
+
result = self.request({"type": "fetch", "path": path}, timeout_ms)
|
|
205
|
+
return base64.b64decode(str(result.get("data", "")))
|
|
206
|
+
|
|
207
|
+
# ── conveniences ─────────────────────────────────────────────────────
|
|
208
|
+
|
|
209
|
+
def follow(
|
|
210
|
+
self,
|
|
211
|
+
job_id: str,
|
|
212
|
+
sink: Callable[[str], None],
|
|
213
|
+
poll_s: float = 0.5,
|
|
214
|
+
timeout_s: float | None = None,
|
|
215
|
+
) -> int:
|
|
216
|
+
"""Stream the log of *job_id* to *sink* until the job ends; returns its exit code.
|
|
217
|
+
|
|
218
|
+
Uses ``jobs log <id> --offset N --json`` on the bench, so nothing is
|
|
219
|
+
held open between polls and a lost connection just resumes.
|
|
220
|
+
|
|
221
|
+
Raises:
|
|
222
|
+
BenchClientError: When the job is unknown or the bench stops answering.
|
|
223
|
+
"""
|
|
224
|
+
offset = 0
|
|
225
|
+
deadline = None if timeout_s is None else time.monotonic() + timeout_s
|
|
226
|
+
while True:
|
|
227
|
+
result = self.exec(["jobs", "log", job_id, "--offset", str(offset), "--json"])
|
|
228
|
+
if not result.ok:
|
|
229
|
+
raise BenchClientError(
|
|
230
|
+
result.stderr.strip() or result.stdout.strip() or "jobs log failed"
|
|
231
|
+
)
|
|
232
|
+
chunk = result.json()
|
|
233
|
+
text = str(chunk.get("text", ""))
|
|
234
|
+
if text:
|
|
235
|
+
sink(text)
|
|
236
|
+
offset = int(chunk.get("offset", offset))
|
|
237
|
+
if not chunk.get("running", False):
|
|
238
|
+
code = chunk.get("returncode")
|
|
239
|
+
return int(code) if code is not None else -1
|
|
240
|
+
if deadline is not None and time.monotonic() >= deadline:
|
|
241
|
+
raise BenchClientError(f"{job_id}: still running after {timeout_s} s")
|
|
242
|
+
time.sleep(poll_s)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: plesty-bench
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Client for a PLESTY bench running plesty-server: run its commands and fetch its reports from another machine.
|
|
5
|
+
Author-email: Yunshuang Yuan <yuanyunshuang@gmail.com>
|
|
6
|
+
Maintainer-email: Plesty Development Team <plesty.dev@example.com>
|
|
7
|
+
License-Expression: LGPL-3.0-or-later
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: LICENSES/LGPL-3.0-or-later.txt
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Requires-Dist: click>=8.1
|
|
12
|
+
Requires-Dist: pyzmq>=26
|
|
13
|
+
Provides-Extra: gui
|
|
14
|
+
Requires-Dist: plesty-lib>=0.3.3; extra == 'gui'
|
|
15
|
+
Requires-Dist: plesty-lib[gui]>=0.3.3; extra == 'gui'
|
|
16
|
+
Requires-Dist: pyyaml>=6.0; extra == 'gui'
|
|
17
|
+
Provides-Extra: server
|
|
18
|
+
Requires-Dist: plesty-lib>=0.3.3; extra == 'server'
|
|
19
|
+
Requires-Dist: pyyaml>=6.0; extra == 'server'
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# plesty-server
|
|
23
|
+
|
|
24
|
+
The bench PC's own console for the PLESTY platform: installs hub device
|
|
25
|
+
modules (several versions side by side), launches and supervises their device
|
|
26
|
+
servers, runs field tests against the instruments, and keeps the logs — so
|
|
27
|
+
running the platform on a lab bench is no longer hand work.
|
|
28
|
+
|
|
29
|
+
Two deliverables from one repository:
|
|
30
|
+
|
|
31
|
+
- **`plesty.server`** — the bench application (CLI `plesty-server`, Qt
|
|
32
|
+
console `plesty-server-gui`, agent), on PyPI as **`plesty-server`**:
|
|
33
|
+
`uv tool install "plesty-server[gui]"` — or the light installers from the
|
|
34
|
+
[releases](https://gitlab.com/plesty/core/plesty-bench/-/releases) (Windows
|
|
35
|
+
`setup.exe`; `install.sh` for macOS/Linux), which do exactly that plus the
|
|
36
|
+
Start-menu / Launchpad entry.
|
|
37
|
+
- **`plesty.bench`** — the remote client, on PyPI as **`plesty-bench`**
|
|
38
|
+
(`uv tool install plesty-bench`). The CLI is the API:
|
|
39
|
+
`plesty-bench -b lab-bench-03 field-test pm100d` runs it on the bench and
|
|
40
|
+
follows the job.
|
|
41
|
+
|
|
42
|
+
Built as model – services – presenter – view, with one module (`host`) for
|
|
43
|
+
everything that differs between Windows and POSIX. See `docs/` for the
|
|
44
|
+
architecture, the process-management and cross-platform primers, the console
|
|
45
|
+
and the remote loop.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
plesty/bench/__init__.py,sha256=43t_V0pMSf-5-7zhG1kUmQ1K0i98TEATYpmAEcHk0iU,1589
|
|
2
|
+
plesty/bench/cli.py,sha256=zs6D4TAyqSJX-JKXhvYZG7q0mfjPU0PcHXdZYToKvyM,4308
|
|
3
|
+
plesty/bench/client.py,sha256=S4DSKRhPDMD5TqnNmAdDMQ_TtIjQMICgaAJiviesntw,9581
|
|
4
|
+
plesty_bench-0.2.0.dist-info/METADATA,sha256=v8Qx2DyxGt_gQUHjdrkfr6_jtRn_AbfBDqS-6_T99CU,2034
|
|
5
|
+
plesty_bench-0.2.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
6
|
+
plesty_bench-0.2.0.dist-info/entry_points.txt,sha256=TmywRL2LSZ0Z8RvgjKdUmugtRIIqYRgPUdq5yrU6gq8,55
|
|
7
|
+
plesty_bench-0.2.0.dist-info/licenses/LICENSE,sha256=u-tB81VfiXPInSOlocR38N9_gBIK-bBsjXpgh3sWMvc,8434
|
|
8
|
+
plesty_bench-0.2.0.dist-info/licenses/LICENSES/LGPL-3.0-or-later.txt,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
9
|
+
plesty_bench-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Copyright (C) 2026 Plesty Development Team
|
|
2
|
+
|
|
3
|
+
This file is part of Plesty.
|
|
4
|
+
|
|
5
|
+
Plesty is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
Plesty is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Lesser General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
along with Plesty. If not, see <https://www.gnu.org/licenses/> or the copy below.
|
|
17
|
+
|
|
18
|
+
#########################################################################
|
|
19
|
+
|
|
20
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
21
|
+
Version 3, 29 June 2007
|
|
22
|
+
|
|
23
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
24
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
25
|
+
of this license document, but changing it is not allowed.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
This version of the GNU Lesser General Public License incorporates
|
|
29
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
30
|
+
License, supplemented by the additional permissions listed below.
|
|
31
|
+
|
|
32
|
+
0. Additional Definitions.
|
|
33
|
+
|
|
34
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
35
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
36
|
+
General Public License.
|
|
37
|
+
|
|
38
|
+
"The Library" refers to a covered work governed by this License,
|
|
39
|
+
other than an Application or a Combined Work as defined below.
|
|
40
|
+
|
|
41
|
+
An "Application" is any work that makes use of an interface provided
|
|
42
|
+
by the Library, but which is not otherwise based on the Library.
|
|
43
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
44
|
+
of using an interface provided by the Library.
|
|
45
|
+
|
|
46
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
47
|
+
Application with the Library. The particular version of the Library
|
|
48
|
+
with which the Combined Work was made is also called the "Linked
|
|
49
|
+
Version".
|
|
50
|
+
|
|
51
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
52
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
53
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
54
|
+
based on the Application, and not on the Linked Version.
|
|
55
|
+
|
|
56
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
57
|
+
object code and/or source code for the Application, including any data
|
|
58
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
59
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
60
|
+
|
|
61
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
62
|
+
|
|
63
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
64
|
+
without being bound by section 3 of the GNU GPL.
|
|
65
|
+
|
|
66
|
+
2. Conveying Modified Versions.
|
|
67
|
+
|
|
68
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
69
|
+
facility refers to a function or data to be supplied by an Application
|
|
70
|
+
that uses the facility (other than as an argument passed when the
|
|
71
|
+
facility is invoked), then you may convey a copy of the modified
|
|
72
|
+
version:
|
|
73
|
+
|
|
74
|
+
a) under this License, provided that you make a good faith effort to
|
|
75
|
+
ensure that, in the event an Application does not supply the
|
|
76
|
+
function or data, the facility still operates, and performs
|
|
77
|
+
whatever part of its purpose remains meaningful, or
|
|
78
|
+
|
|
79
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
80
|
+
this License applicable to that copy.
|
|
81
|
+
|
|
82
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
83
|
+
|
|
84
|
+
The object code form of an Application may incorporate material from
|
|
85
|
+
a header file that is part of the Library. You may convey such object
|
|
86
|
+
code under terms of your choice, provided that, if the incorporated
|
|
87
|
+
material is not limited to numerical parameters, data structure
|
|
88
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
89
|
+
(ten or fewer lines in length), you do both of the following:
|
|
90
|
+
|
|
91
|
+
a) Give prominent notice with each copy of the object code that the
|
|
92
|
+
Library is used in it and that the Library and its use are
|
|
93
|
+
covered by this License.
|
|
94
|
+
|
|
95
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
96
|
+
document.
|
|
97
|
+
|
|
98
|
+
4. Combined Works.
|
|
99
|
+
|
|
100
|
+
You may convey a Combined Work under terms of your choice that,
|
|
101
|
+
taken together, effectively do not restrict modification of the
|
|
102
|
+
portions of the Library contained in the Combined Work and reverse
|
|
103
|
+
engineering for debugging such modifications, if you also do each of
|
|
104
|
+
the following:
|
|
105
|
+
|
|
106
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
107
|
+
the Library is used in it and that the Library and its use are
|
|
108
|
+
covered by this License.
|
|
109
|
+
|
|
110
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
111
|
+
document.
|
|
112
|
+
|
|
113
|
+
c) For a Combined Work that displays copyright notices during
|
|
114
|
+
execution, include the copyright notice for the Library among
|
|
115
|
+
these notices, as well as a reference directing the user to the
|
|
116
|
+
copies of the GNU GPL and this license document.
|
|
117
|
+
|
|
118
|
+
d) Do one of the following:
|
|
119
|
+
|
|
120
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
121
|
+
License, and the Corresponding Application Code in a form
|
|
122
|
+
suitable for, and under terms that permit, the user to
|
|
123
|
+
recombine or relink the Application with a modified version of
|
|
124
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
125
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
126
|
+
Corresponding Source.
|
|
127
|
+
|
|
128
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
129
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
130
|
+
a copy of the Library already present on the user's computer
|
|
131
|
+
system, and (b) will operate properly with a modified version
|
|
132
|
+
of the Library that is interface-compatible with the Linked
|
|
133
|
+
Version.
|
|
134
|
+
|
|
135
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
136
|
+
be required to provide such information under section 6 of the
|
|
137
|
+
GNU GPL, and only to the extent that such information is
|
|
138
|
+
necessary to install and execute a modified version of the
|
|
139
|
+
Combined Work produced by recombining or relinking the
|
|
140
|
+
Application with a modified version of the Linked Version. (If
|
|
141
|
+
you use option 4d0, the Installation Information must accompany
|
|
142
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
143
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
144
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
145
|
+
for conveying Corresponding Source.)
|
|
146
|
+
|
|
147
|
+
5. Combined Libraries.
|
|
148
|
+
|
|
149
|
+
You may place library facilities that are a work based on the
|
|
150
|
+
Library side by side in a single library together with other library
|
|
151
|
+
facilities that are not Applications and are not covered by this
|
|
152
|
+
License, and convey such a combined library under terms of your
|
|
153
|
+
choice, if you do both of the following:
|
|
154
|
+
|
|
155
|
+
a) Accompany the combined library with a copy of the same work based
|
|
156
|
+
on the Library, uncombined with any other library facilities,
|
|
157
|
+
conveyed under the terms of this License.
|
|
158
|
+
|
|
159
|
+
b) Give prominent notice with the combined library that part of it
|
|
160
|
+
is a work based on the Library, and explaining where to find the
|
|
161
|
+
accompanying uncombined form of the same work.
|
|
162
|
+
|
|
163
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
164
|
+
|
|
165
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
166
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
167
|
+
versions will be similar in spirit to the present version, but may
|
|
168
|
+
differ in detail to address new problems or concerns.
|
|
169
|
+
|
|
170
|
+
Each version is given a distinguishing version number. If the
|
|
171
|
+
Library as you received it specifies that a certain numbered version
|
|
172
|
+
of the GNU Lesser General Public License "or any later version"
|
|
173
|
+
applies to it, you have the option of following the terms and
|
|
174
|
+
conditions either of that published version or of any later version
|
|
175
|
+
published by the Free Software Foundation. If the Library as you
|
|
176
|
+
received it does not specify a version number of the GNU Lesser
|
|
177
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
178
|
+
General Public License ever published by the Free Software Foundation.
|
|
179
|
+
|
|
180
|
+
If the Library as you received it specifies that a proxy can decide
|
|
181
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
182
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
183
|
+
permanent authorization for you to choose that version for the
|
|
184
|
+
Library.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|