plesty-server 0.4.2__tar.gz → 0.4.3__tar.gz

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.
Files changed (56) hide show
  1. {plesty_server-0.4.2 → plesty_server-0.4.3}/PKG-INFO +4 -4
  2. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/home.py +32 -2
  3. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/job.py +17 -9
  4. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/process.py +4 -0
  5. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/presenter/bench.py +43 -4
  6. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/control.py +56 -1
  7. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/launch.py +111 -2
  8. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/run_report.py +15 -3
  9. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/supervisor.py +35 -17
  10. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/view/control.py +42 -0
  11. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/view/dialogs.py +4 -1
  12. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/view/window.py +114 -16
  13. {plesty_server-0.4.2 → plesty_server-0.4.3}/pyproject.toml +4 -4
  14. {plesty_server-0.4.2 → plesty_server-0.4.3}/LICENSE +0 -0
  15. {plesty_server-0.4.2 → plesty_server-0.4.3}/LICENSES/LGPL-3.0-or-later.txt +0 -0
  16. {plesty_server-0.4.2 → plesty_server-0.4.3}/README.md +0 -0
  17. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/__init__.py +0 -0
  18. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/__main__.py +0 -0
  19. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/assets/console.qss +0 -0
  20. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/assets/env.example +0 -0
  21. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/assets/fleet.example.yaml +0 -0
  22. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/assets/plesty-mark.svg +0 -0
  23. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/assets/report.css +0 -0
  24. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/assets/report.html +0 -0
  25. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/cli/__init__.py +0 -0
  26. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/cli/main.py +0 -0
  27. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/config.yaml +0 -0
  28. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/host.py +0 -0
  29. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/__init__.py +0 -0
  30. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/agent.py +0 -0
  31. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/catalogue.py +0 -0
  32. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/device.py +0 -0
  33. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/device_manager.py +0 -0
  34. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/envfile.py +0 -0
  35. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/errors.py +0 -0
  36. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/experiment.py +0 -0
  37. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/field_test.py +0 -0
  38. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/fleet.py +0 -0
  39. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/peer.py +0 -0
  40. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/ports.py +0 -0
  41. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/purge.py +0 -0
  42. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/model/traffic.py +0 -0
  43. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/presenter/__init__.py +0 -0
  44. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/reexec.py +0 -0
  45. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/__init__.py +0 -0
  46. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/agent.py +0 -0
  47. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/catalogue.py +0 -0
  48. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/experiments.py +0 -0
  49. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/gitbin.py +0 -0
  50. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/installer.py +0 -0
  51. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/jobs.py +0 -0
  52. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/nodes.py +0 -0
  53. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/services/problem_report.py +0 -0
  54. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/view/__init__.py +0 -0
  55. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/view/app.py +0 -0
  56. {plesty_server-0.4.2 → plesty_server-0.4.3}/plesty/server/view/workers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: plesty-server
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: The PLESTY bench application: installs, runs and field-tests device servers.
5
5
  Project-URL: Homepage, https://gitlab.com/plesty/core/plesty-bench
6
6
  Project-URL: Documentation, https://plesty.gitlab.io/core/plesty-bench/
@@ -11,12 +11,12 @@ License-File: LICENSE
11
11
  License-File: LICENSES/LGPL-3.0-or-later.txt
12
12
  Requires-Python: >=3.12
13
13
  Requires-Dist: click>=8.1
14
- Requires-Dist: plesty-bench==0.4.2
15
- Requires-Dist: plesty-lib[report]>=0.5.0
14
+ Requires-Dist: plesty-bench==0.4.3
15
+ Requires-Dist: plesty-lib[report]>=0.5.2
16
16
  Requires-Dist: pyyaml>=6.0
17
17
  Requires-Dist: pyzmq>=26
18
18
  Provides-Extra: gui
19
- Requires-Dist: plesty-lib[gui]>=0.5.0; extra == 'gui'
19
+ Requires-Dist: plesty-lib[gui]>=0.5.2; extra == 'gui'
20
20
  Requires-Dist: pyside6==6.11.2; extra == 'gui'
21
21
  Description-Content-Type: text/markdown
22
22
 
@@ -14,6 +14,7 @@ from __future__ import annotations
14
14
 
15
15
  import os
16
16
  from dataclasses import dataclass
17
+ from datetime import datetime
17
18
  from pathlib import Path
18
19
 
19
20
  from plesty.server import load_config
@@ -136,8 +137,37 @@ class Home:
136
137
  return self.venvs / name
137
138
 
138
139
  def log(self, name: str) -> Path:
139
- """Log file of the device *name*."""
140
- return self.logs / f"{name}.log"
140
+ """The current log file of the device *name*.
141
+
142
+ Each server start, and each Clear log, opens a new file named with its
143
+ time (:meth:`new_log`); ``logs/<name>.current`` names the one in use.
144
+ Without a pointer — a log written before there were any — it is the
145
+ single ``logs/<name>.log`` every start used to append to.
146
+ """
147
+ pointer = self.logs / f"{name}.current"
148
+ try:
149
+ current = self.logs / pointer.read_text(encoding="utf-8").strip()
150
+ except OSError:
151
+ return self.logs / f"{name}.log"
152
+ return current if current.name and current.is_file() else self.logs / f"{name}.log"
153
+
154
+ def new_log(self, name: str) -> Path:
155
+ """Start a new log file for *name*, make it the current one, and return it.
156
+
157
+ Named ``<name>-<YYYYMMDD-HHMMSS>.log``. Older files stay: a clear never
158
+ truncates a file a running server writes, which is what left an 11.7 MB
159
+ log no reader could get through (#23).
160
+ """
161
+ self.logs.mkdir(parents=True, exist_ok=True)
162
+ stamp = datetime.now().strftime("%Y%m%d-%H%M%S")
163
+ path = self.logs / f"{name}-{stamp}.log"
164
+ count = 1
165
+ while path.exists():
166
+ path = self.logs / f"{name}-{stamp}-{count}.log"
167
+ count += 1
168
+ path.touch()
169
+ (self.logs / f"{name}.current").write_text(path.name + "\n", encoding="utf-8")
170
+ return path
141
171
 
142
172
  def state_file(self, name: str) -> Path:
143
173
  """Process-state file of the device *name*."""
@@ -254,20 +254,28 @@ class JobStore:
254
254
  return tail_file(Path(job.log), lines)
255
255
 
256
256
 
257
- def tail_file(path: Path, lines: int, block: int = 8192) -> str:
258
- """The last *lines* lines of *path*, read from the end in *block* steps."""
257
+ #: The most of a log's end :func:`tail_file` reads, in bytes.
258
+ TAIL_LIMIT = 256 * 1024
259
+
260
+
261
+ def tail_file(path: Path, lines: int, limit: int = TAIL_LIMIT) -> str:
262
+ """The last *lines* lines of *path*, read from at most its last *limit* bytes.
263
+
264
+ One read of a bounded span. The loop this replaced prepended each 8 KB
265
+ block to everything read so far until enough newlines turned up — on a
266
+ file with none (a truncated log a server kept writing at its old offset
267
+ fills with NULs) that is quadratic in the file's size, and an 11.7 MB log
268
+ hung the console, the agent and every reader with it (#23). A line longer
269
+ than *limit* is shown from its last *limit* bytes.
270
+ """
259
271
  if lines <= 0 or not path.is_file():
260
272
  return ""
261
273
  with path.open("rb") as fh:
262
274
  fh.seek(0, os.SEEK_END)
263
275
  end = fh.tell()
264
- data = b""
265
- while end > 0 and data.count(b"\n") <= lines:
266
- step = min(block, end)
267
- end -= step
268
- fh.seek(end)
269
- data = fh.read(step) + data
270
- text = data.decode("utf-8", errors="replace")
276
+ fh.seek(max(0, end - limit))
277
+ data = fh.read(limit)
278
+ text = data.decode("utf-8", errors="replace").replace("\x00", "")
271
279
  return "\n".join(text.splitlines()[-lines:])
272
280
 
273
281
 
@@ -46,6 +46,9 @@ class ProcessRecord:
46
46
  env: The spec's environment — likewise.
47
47
  package: Distribution the server runs, for listings.
48
48
  version: Its installed version, for listings.
49
+ relayed: Its waiter copies the output into the log and can switch it
50
+ to a new file while it runs. ``False`` for a server an older
51
+ bench started, whose log is the server's own handle (#23).
49
52
  """
50
53
 
51
54
  name: str
@@ -61,6 +64,7 @@ class ProcessRecord:
61
64
  env: dict[str, str] = field(default_factory=dict)
62
65
  package: str = ""
63
66
  version: str = ""
67
+ relayed: bool = False
64
68
 
65
69
  def to_dict(self) -> dict[str, Any]:
66
70
  """JSON form."""
@@ -432,8 +432,14 @@ class Bench:
432
432
  """
433
433
  resolved_home = Home.resolve(home)
434
434
  path = find_fleet(fleet_path, resolved_home.root)
435
- if path is None and resolved_home.last_fleet.is_file():
436
- # what the console used last — so a double-click opens where it left off
435
+ default = resolved_home.root / FLEET_FILENAME
436
+ unchosen = fleet_path is None and (path is None or path == default)
437
+ if unchosen and resolved_home.last_fleet.is_file():
438
+ # What the console used last outranks the home's default fleet.yaml,
439
+ # so a reopened app — after a crash too — comes back to the fleet
440
+ # whose servers are still running rather than to a stale default
441
+ # that orphans them (#24). An explicit -f and a fleet.yaml in the
442
+ # working directory still win: both were put there on purpose.
437
443
  remembered = Path(resolved_home.last_fleet.read_text(encoding="utf-8").strip())
438
444
  if remembered.is_file():
439
445
  path = remembered
@@ -568,6 +574,8 @@ class Bench:
568
574
  if source.exists():
569
575
  target.parent.mkdir(parents=True, exist_ok=True)
570
576
  source.rename(target)
577
+ # the old name's pointer named the file just moved (#23)
578
+ (self.home.logs / f"{old}.current").unlink(missing_ok=True)
571
579
  self.fleet = fleet
572
580
  self._save_fleet()
573
581
  return self.fleet[new]
@@ -629,6 +637,11 @@ class Bench:
629
637
  """
630
638
  self.fleet = load_fleet(path)
631
639
  self.remember_fleet()
640
+ if self._agent is not None:
641
+ # The agent passes its fleet to every command it runs; left on the
642
+ # one it started with, a remote declare or start acted on another
643
+ # fleet than the operator sees (#24).
644
+ self._agent.service.fleet_path = self.fleet.path
632
645
  return self.fleet
633
646
 
634
647
  def open_fleet(self, path: str | os.PathLike[str], create: bool = False) -> Fleet:
@@ -1023,7 +1036,10 @@ class Bench:
1023
1036
  found = sorted(
1024
1037
  f"config/{item.name}"
1025
1038
  for item in directory.iterdir()
1026
- if item.is_file() and item.suffix in (".yaml", ".yml")
1039
+ if item.is_file()
1040
+ and item.suffix in (".yaml", ".yml")
1041
+ # macOS's AppleDouble companion on a share, not a config
1042
+ and not item.name.startswith("._")
1027
1043
  )
1028
1044
  except (BenchError, FleetError, OSError):
1029
1045
  # Not installed yet, or a checkout this bench cannot reach: the
@@ -2925,6 +2941,18 @@ class Bench:
2925
2941
  """
2926
2942
  return [n for n in self.stoppable() if self.supervisor.alive(n)]
2927
2943
 
2944
+ def orphans(self) -> list[str]:
2945
+ """Servers alive on this bench that the current fleet does not declare.
2946
+
2947
+ A fleet opened in place of the one that started them — a stale default
2948
+ after a crash — drops them out of the table while they keep their
2949
+ ports and the instruments' sessions. Named, they can be stopped (#24).
2950
+ """
2951
+ declared = set(self.fleet.devices)
2952
+ return [
2953
+ n for n in self.supervisor.known() if n not in declared and self.supervisor.alive(n)
2954
+ ]
2955
+
2928
2956
  def run(
2929
2957
  self,
2930
2958
  stop: threading.Event,
@@ -3109,7 +3137,18 @@ class Bench:
3109
3137
  if blocked is not None:
3110
3138
  raise BenchError(f"{name}: {blocked}")
3111
3139
  port = self.status(name).port
3112
- return DeviceLink(name, f"tcp://{PROBE_HOST}:{port}")
3140
+
3141
+ def where() -> str | None:
3142
+ # The process record only: this runs before every call the panel
3143
+ # makes, and a probe per call would double the traffic. A server
3144
+ # that is gone has no address: a call there would wait out the
3145
+ # whole timeout for a reply nobody sends (#22).
3146
+ now = self.status(name, probe=False)
3147
+ if now.state not in (RUNNING, STARTING) or not now.port:
3148
+ return None
3149
+ return f"tcp://{PROBE_HOST}:{now.port}"
3150
+
3151
+ return DeviceLink(name, f"tcp://{PROBE_HOST}:{port}", resolve=where)
3113
3152
 
3114
3153
  def field_test_availability(self, name: str, tier: str = "host") -> str | None:
3115
3154
  """Why the field test of *name* cannot run, or ``None`` when it can.
@@ -26,6 +26,7 @@ instead, behind *Take control*.
26
26
 
27
27
  from __future__ import annotations
28
28
 
29
+ from collections.abc import Callable
29
30
  from typing import Any
30
31
 
31
32
  #: How long one device call may take before the link gives up, in
@@ -37,25 +38,79 @@ DEVICE_TIMEOUT_MS = 15000
37
38
  class DeviceLink:
38
39
  """A lazy :class:`~plesty.lib.ui.device_link.DeviceHandle` over one device server."""
39
40
 
40
- def __init__(self, name: str, address: str, timeout_ms: int = DEVICE_TIMEOUT_MS) -> None:
41
+ def __init__(
42
+ self,
43
+ name: str,
44
+ address: str,
45
+ timeout_ms: int = DEVICE_TIMEOUT_MS,
46
+ resolve: Callable[[], str | None] | None = None,
47
+ ) -> None:
41
48
  """Prepare a link; nothing is connected yet.
42
49
 
43
50
  Args:
44
51
  name: The device's fleet name, for messages.
45
52
  address: ZMQ endpoint of its server, ``tcp://host:port``.
46
53
  timeout_ms: Reply timeout for one call.
54
+ resolve: Returns where the server is now, or ``None`` when it is
55
+ not running; raises when that is not known. A restarted server
56
+ can come back on another port; a link that kept the first
57
+ address drove a port nobody listened on, and the panel's
58
+ controls silently did nothing (#22).
47
59
  """
48
60
  self.name = name
49
61
  self.address = address
50
62
  self.timeout_ms = timeout_ms
63
+ self._resolve = resolve
51
64
  self._client: Any = None
65
+ self._held = False
66
+
67
+ def hold(self) -> None:
68
+ """Refuse every call until :meth:`release`: the server is being stopped.
69
+
70
+ A call sent to a server that is shutting down, or to the port it left,
71
+ gets no reply and waits out the whole timeout — and every call after it
72
+ waits behind it on the panel's one worker. Restarting on a new port
73
+ left the panel dead for up to fifteen seconds that way (#22). Held, a
74
+ call fails at once and sends nothing.
75
+ """
76
+ self._held = True
77
+
78
+ def release(self) -> None:
79
+ """Let calls through again after :meth:`hold`."""
80
+ self._held = False
81
+
82
+ def _follow(self) -> None:
83
+ """Move to the server's current address, dropping a client on the old one.
84
+
85
+ Raises:
86
+ ConnectionError: When the server is not running, rather than send
87
+ a call to an address nothing answers on.
88
+ """
89
+ if self._resolve is None:
90
+ return
91
+ try:
92
+ current = self._resolve()
93
+ except Exception: # noqa: BLE001 — not knowing where it is now is not a new address
94
+ return
95
+ if current is None:
96
+ self.close()
97
+ raise ConnectionError(f"{self.name} is not running")
98
+ if current != self.address:
99
+ self.close()
100
+ self.address = current
52
101
 
53
102
  def client(self) -> Any:
54
103
  """Return the connected client, building it on first use.
55
104
 
56
105
  Returns:
57
106
  The ``DeviceTCPIPClient``.
107
+
108
+ Raises:
109
+ ConnectionError: When the link is held or the server is not running.
58
110
  """
111
+ if self._held:
112
+ raise ConnectionError(f"{self.name} is restarting")
113
+ self._follow()
59
114
  if self._client is None:
60
115
  from plesty.lib.service import build_client
61
116
 
@@ -24,6 +24,7 @@ import os
24
24
  import shutil
25
25
  import subprocess
26
26
  import sys
27
+ import threading
27
28
  import time
28
29
  from collections.abc import Mapping, Sequence
29
30
  from datetime import UTC, datetime
@@ -44,6 +45,41 @@ def stop_file(exit_file: str | os.PathLike[str]) -> Path:
44
45
  return Path(f"{exit_file}.stop")
45
46
 
46
47
 
48
+ def switch_file(exit_file: str | os.PathLike[str]) -> Path:
49
+ """The file that asks the waiter of *exit_file* to write to another log.
50
+
51
+ Its content is the path of the new log. The waiter opens it, writes there
52
+ from then on, and removes this file to say it has (see
53
+ :func:`request_switch`).
54
+ """
55
+ return Path(f"{exit_file}.switch")
56
+
57
+
58
+ #: Seconds between the waiter's looks for a switch request.
59
+ SWITCH_POLL_S = 0.2
60
+
61
+
62
+ def request_switch(
63
+ exit_file: str | os.PathLike[str], log: str | os.PathLike[str], timeout: float = 5.0
64
+ ) -> bool:
65
+ """Ask a relaying waiter to write to *log* from now on; ``True`` once it has.
66
+
67
+ A file rather than a signal, for the reason the stop is one: on Windows
68
+ nothing outside the waiter's console can signal it.
69
+ """
70
+ request = switch_file(exit_file)
71
+ tmp = Path(f"{request}.tmp")
72
+ tmp.write_text(str(log), encoding="utf-8")
73
+ os.replace(tmp, request)
74
+ deadline = time.monotonic() + timeout
75
+ while request.exists():
76
+ if time.monotonic() >= deadline:
77
+ request.unlink(missing_ok=True)
78
+ return False
79
+ time.sleep(SWITCH_POLL_S / 2)
80
+ return True
81
+
82
+
47
83
  def _resolve(executable: str, env: Mapping[str, str]) -> str:
48
84
  """*executable* as an absolute path, found on the ``PATH`` *env* carries.
49
85
 
@@ -77,6 +113,7 @@ def launch(
77
113
  log: str | os.PathLike[str],
78
114
  exit_file: str | os.PathLike[str],
79
115
  banner: str = "",
116
+ relay: bool = False,
80
117
  ) -> int:
81
118
  """Start *command* detached; return the pid of the waiter that owns it.
82
119
 
@@ -89,6 +126,11 @@ def launch(
89
126
  first, so its presence means "finished").
90
127
  banner: A line written to the log before this function returns, so a
91
128
  caller may read the log on the pid it is handed.
129
+ relay: The waiter copies the command's output into the log rather
130
+ than handing the command the file, so the log can be switched to
131
+ another file while it runs (:func:`request_switch`). For a device
132
+ server, whose log is cleared while it runs; a job's log is never
133
+ switched and keeps the direct handle.
92
134
 
93
135
  Raises:
94
136
  OSError: When the waiter itself cannot be started.
@@ -108,6 +150,7 @@ def launch(
108
150
  Path(exit_file).unlink(missing_ok=True)
109
151
  stop = stop_file(exit_file)
110
152
  stop.unlink(missing_ok=True) # a stale one would stop the new command at once
153
+ switch_file(exit_file).unlink(missing_ok=True) # likewise a stale switch
111
154
  Path(log).parent.mkdir(parents=True, exist_ok=True)
112
155
  # Written here rather than by the waiter, so that the log carries its
113
156
  # header by the time this function returns. The waiter reports its pid
@@ -135,6 +178,7 @@ def launch(
135
178
  "log": str(log),
136
179
  "exit_file": str(exit_file),
137
180
  "stop_file": str(stop),
181
+ "switch_file": str(switch_file(exit_file)) if relay else "",
138
182
  }
139
183
  # Read the pid the launcher prints; never wait for the launcher to finish —
140
184
  # on Windows the launcher *is* the waiter and lives as long as the command.
@@ -212,6 +256,7 @@ def _wait(spec: dict[str, Any]) -> int:
212
256
  host.deliver_stop(child)
213
257
 
214
258
  host.forward_signals(forward)
259
+ relay = bool(spec.get("switch_file"))
215
260
  with open(spec["log"], "ab") as log:
216
261
  try:
217
262
  holder["child"] = subprocess.Popen(
@@ -219,7 +264,7 @@ def _wait(spec: dict[str, Any]) -> int:
219
264
  cwd=spec["cwd"],
220
265
  env=spec["env"],
221
266
  stdin=subprocess.DEVNULL,
222
- stdout=log,
267
+ stdout=subprocess.PIPE if relay else log,
223
268
  stderr=subprocess.STDOUT,
224
269
  **host.interruptible_kwargs(),
225
270
  )
@@ -230,14 +275,78 @@ def _wait(spec: dict[str, Any]) -> int:
230
275
  # Windows cannot signal us across consoles; the stop file is how a stop
231
276
  # arrives there. Registered once the child exists, so it can be delivered.
232
277
  host.watch_for_stop(Path(spec["stop_file"]), lambda: host.deliver_stop(holder["child"]))
278
+ sink = _Relay(spec["log"], holder["child"], Path(spec["switch_file"])) if relay else None
233
279
  code = holder["child"].wait()
280
+ current = sink.finish() if sink is not None else spec["log"]
234
281
  stamp = datetime.now(UTC).isoformat(timespec="seconds")
235
- with open(spec["log"], "ab") as log:
282
+ with open(current, "ab") as log:
236
283
  log.write(f"=== exit {code} at {stamp}\n".encode())
237
284
  _write_exit(spec["exit_file"], code)
238
285
  return code
239
286
 
240
287
 
288
+ class _Relay:
289
+ """Copy a child's output into the current log, and move to another on request.
290
+
291
+ The log used to be the child's own stdout. Clearing it then had to truncate
292
+ a file the server kept writing at its old offset: the gap filled with NULs,
293
+ and an 11.7 MB log with no line breaks hung every reader (#23). Here the
294
+ waiter holds the file, so it can close one and open the next between two
295
+ reads, and nothing is ever truncated.
296
+ """
297
+
298
+ def __init__(self, log: str, child: subprocess.Popen[bytes], request: Path) -> None:
299
+ self.path = log
300
+ self._file = open(log, "ab") # noqa: SIM115 — swapped on request, closed in finish()
301
+ self._lock = threading.Lock()
302
+ self._done = threading.Event()
303
+ self._request = request
304
+ self._reader = threading.Thread(target=self._copy, args=(child,), daemon=True)
305
+ self._reader.start()
306
+ threading.Thread(target=self._watch, daemon=True).start()
307
+
308
+ def _copy(self, child: subprocess.Popen[bytes]) -> None:
309
+ stream = child.stdout
310
+ if stream is None: # pragma: no cover — PIPE was asked for
311
+ return
312
+ fd = stream.fileno()
313
+ while True:
314
+ try:
315
+ chunk = os.read(fd, 65536)
316
+ except OSError:
317
+ break
318
+ if not chunk:
319
+ break
320
+ with self._lock:
321
+ self._file.write(chunk)
322
+ self._file.flush()
323
+
324
+ def _watch(self) -> None:
325
+ while not self._done.is_set():
326
+ if self._request.exists():
327
+ try:
328
+ target = self._request.read_text(encoding="utf-8").strip()
329
+ except OSError:
330
+ target = ""
331
+ if target:
332
+ with self._lock:
333
+ self._file.close()
334
+ self._file = open(target, "ab") # noqa: SIM115
335
+ self.path = target
336
+ self._request.unlink(missing_ok=True) # the acknowledgement
337
+ self._done.wait(SWITCH_POLL_S)
338
+
339
+ def finish(self) -> str:
340
+ """Drain what the child left, close the file, and return the log in use."""
341
+ # A grandchild that inherited the pipe can hold it open past the
342
+ # child's exit; the exit line must not wait on it for ever.
343
+ self._reader.join(timeout=2.0)
344
+ self._done.set()
345
+ with self._lock:
346
+ self._file.close()
347
+ return self.path
348
+
349
+
241
350
  def _write_exit(exit_file: str, code: int) -> None:
242
351
  tmp = Path(exit_file + ".tmp")
243
352
  tmp.write_text(f"{code}\n", encoding="utf-8")
@@ -123,6 +123,16 @@ def _read_json(path: Path) -> dict[str, Any]:
123
123
  return parsed if isinstance(parsed, dict) else {}
124
124
 
125
125
 
126
+ def _listing(directory: Path, pattern: str) -> list[Path]:
127
+ """The files *pattern* matches, without macOS AppleDouble companions.
128
+
129
+ macOS writes a binary ``._<name>`` beside every file it writes on an SMB
130
+ share, so a run written from a Mac carries ``analysis/._QD01.report.json``
131
+ — matched by every pattern here and readable as none of them.
132
+ """
133
+ return sorted(path for path in directory.glob(pattern) if not path.name.startswith("._"))
134
+
135
+
126
136
  def _read_lines(path: Path) -> list[dict[str, Any]]:
127
137
  """Every complete line of a JSON Lines file, tolerating a torn last one."""
128
138
  try:
@@ -179,7 +189,7 @@ def _analyses(run_dir: Path) -> list[dict[str, Any]]:
179
189
  if not directory.is_dir():
180
190
  return []
181
191
  found: list[dict[str, Any]] = []
182
- for path in sorted(directory.glob("*.json")):
192
+ for path in _listing(directory, "*.json"):
183
193
  if path.name.endswith(REPORT_SUFFIX):
184
194
  continue # an analyzer's report, read by _reports
185
195
  document = _read_json(path)
@@ -227,10 +237,12 @@ def _reports(run_dir: Path) -> list[dict[str, Any]]:
227
237
  except ImportError:
228
238
  return []
229
239
  found: list[dict[str, Any]] = []
230
- for path in sorted(directory.glob(f"*{REPORT_SUFFIX}")):
240
+ for path in _listing(directory, f"*{REPORT_SUFFIX}"):
231
241
  try:
232
242
  report = Report.load(path)
233
- except (UnreadableReport, OSError):
243
+ except (UnreadableReport, OSError, ValueError):
244
+ # ValueError covers UnicodeDecodeError: a file that is not text is
245
+ # no report, and one bad file must not cost the run its report.
234
246
  continue
235
247
  title = report.title or path.name.removesuffix(REPORT_SUFFIX)
236
248
  report.title = "" # the section heading says it
@@ -45,7 +45,7 @@ from plesty.server.model.process import (
45
45
  ProcessRecord,
46
46
  ProcessStatus,
47
47
  )
48
- from plesty.server.services.launch import launch, read_exit, stop_file
48
+ from plesty.server.services.launch import launch, read_exit, request_switch, stop_file
49
49
 
50
50
  #: Host every probe targets — servers bind ``tcp://*`` on the bench itself.
51
51
  PROBE_HOST = "127.0.0.1"
@@ -324,7 +324,8 @@ class Supervisor:
324
324
  self.home.ensure()
325
325
  run_dir = self.home.run_dir(spec.name)
326
326
  run_dir.mkdir(parents=True, exist_ok=True)
327
- log_path = self.home.log(spec.name)
327
+ # A new file per start, so Clear log never has to truncate one (#23).
328
+ log_path = self.home.new_log(spec.name)
328
329
  command = [str(python), "-m", spec.module, *spec.launch_args]
329
330
  env = {**os.environ, **spec.env, "PYTHONUNBUFFERED": "1"}
330
331
  try:
@@ -334,7 +335,8 @@ class Supervisor:
334
335
  env=env,
335
336
  log=log_path,
336
337
  exit_file=self.exit_file(spec.name),
337
- banner=f"\n=== plesty-server start {_now()} :: {' '.join(command)}",
338
+ banner=f"=== plesty-server start {_now()} :: {' '.join(command)}",
339
+ relay=True,
338
340
  )
339
341
  except (OSError, RuntimeError) as exc:
340
342
  raise SupervisorError(f"{spec.name}: cannot launch {command[0]}: {exc}") from exc
@@ -352,6 +354,7 @@ class Supervisor:
352
354
  env=dict(spec.env),
353
355
  package=package or spec.package,
354
356
  version=version,
357
+ relayed=True,
355
358
  ).save(self.home.state_file(spec.name))
356
359
  if wait:
357
360
  self.wait_ready(spec.name, timeout)
@@ -451,27 +454,42 @@ class Supervisor:
451
454
  return tail_file(self.home.log(name), lines)
452
455
 
453
456
  def clear_log(self, name: str) -> int:
454
- """Empty the log of *name*; returns the bytes discarded.
457
+ """Start a new, empty log for *name*; returns the size of the one set aside.
455
458
 
456
- Truncated in place rather than deleted. A running server holds the file
457
- open and appends to it: deleting it on Windows either fails or leaves
458
- the server writing to a handle with no name, and on POSIX the next line
459
- lands in a file nobody is reading. Setting the length to zero keeps the
460
- one handle valid, so a device being watched carries straight on into an
461
- empty log.
459
+ Nothing is truncated or deleted. Truncating a file a running server
460
+ writes left it writing at its old offset: the gap filled with NULs, and
461
+ an 11.7 MB log with no line breaks hung the console, the agent and
462
+ every reader (#23). The old file stays beside the new one.
463
+
464
+ A running server's waiter is asked to write to the new file
465
+ (:func:`~plesty.server.services.launch.request_switch`). One started by
466
+ an older bench hands the server the file itself and cannot switch, so
467
+ it is refused with what to do instead.
462
468
 
463
469
  Args:
464
470
  name: The device whose log to clear.
465
471
 
466
472
  Returns:
467
- How many bytes were dropped; ``0`` when there was no log.
473
+ The size of the log set aside; ``0`` when there was none.
474
+
475
+ Raises:
476
+ SupervisorError: When the server is running and cannot switch, or
477
+ did not take the new file.
468
478
  """
469
- path = self.home.log(name)
470
- if not path.is_file():
471
- return 0
472
- size = path.stat().st_size
473
- with path.open("r+b") as handle:
474
- handle.truncate(0)
479
+ old = self.home.log(name)
480
+ size = old.stat().st_size if old.is_file() else 0
481
+ record = self.record(name)
482
+ running = record is not None and self.alive(name)
483
+ if record is not None and running and not record.relayed:
484
+ raise SupervisorError(
485
+ f"{name}: this server was started by an older bench and writes its log"
486
+ " itself; stop it, then clear the log"
487
+ )
488
+ new = self.home.new_log(name)
489
+ if running and not request_switch(self.exit_file(name), new):
490
+ raise SupervisorError(
491
+ f"{name}: the server did not move to the new log; it still writes {old.name}"
492
+ )
475
493
  return size
476
494
 
477
495
  def _wait_exit(self, name: str, timeout: float) -> bool:
@@ -76,6 +76,8 @@ class ControlWindow(Shell):
76
76
  """
77
77
  super().__init__(title or TITLE, interval_ms=INTERVAL_MS, parent=parent)
78
78
  self.bench = bench
79
+ #: Set once the window has been closed: its panels are spent.
80
+ self.closed = False
79
81
  # A parented QMainWindow is a child widget unless it is told otherwise;
80
82
  # as a Window it gets its own frame, task-bar entry and screen, which is
81
83
  # the whole point of being able to drag it to a second monitor.
@@ -224,6 +226,42 @@ class ControlWindow(Shell):
224
226
  """The devices that currently have a panel, in the order they were opened."""
225
227
  return list(self.panels)
226
228
 
229
+ def reread(self, name: str) -> bool:
230
+ """Have the panel of *name* read its device again; ``False`` when it has none.
231
+
232
+ After the server is started or restarted the panel has made no call,
233
+ so the error banner of the last one that failed stayed up over a
234
+ device that now answers (#22). A fresh read replaces the values the
235
+ old server reported and, when it succeeds, clears the banner.
236
+ """
237
+ dock = self.panels.get(name)
238
+ if dock is None:
239
+ return False
240
+ panel = dock.panel
241
+ assert isinstance(panel, DevicePanel)
242
+ release = getattr(getattr(panel, "handle", None), "release", None)
243
+ if callable(release):
244
+ release()
245
+ panel.read_once()
246
+ return True
247
+
248
+ def hold(self, name: str) -> bool:
249
+ """Stop the panel of *name* calling its server while it is stopped.
250
+
251
+ Released by :meth:`reread` once the server is back. A handle that
252
+ cannot be held — a node's relay — is left as it is.
253
+
254
+ Returns:
255
+ Whether there was a panel to hold.
256
+ """
257
+ dock = self.panels.get(name)
258
+ if dock is None:
259
+ return False
260
+ hold = getattr(getattr(dock.panel, "handle", None), "hold", None)
261
+ if callable(hold):
262
+ hold()
263
+ return True
264
+
227
265
  def closeEvent(self, event: Any) -> None: # noqa: N802 - Qt naming
228
266
  """Stop every panel's worker, then release the connections.
229
267
 
@@ -234,6 +272,10 @@ class ControlWindow(Shell):
234
272
  super().closeEvent(event) # closes every panel, joining every worker
235
273
  for panel in panels:
236
274
  _release(panel)
275
+ # Its panels have stopped workers and closed links and its clock is
276
+ # stopped: shown again, it would show the last state for good and send
277
+ # every call nowhere (#22). The console builds a fresh window instead.
278
+ self.closed = True
237
279
 
238
280
 
239
281
  def _release(panel: Any) -> None:
@@ -3639,7 +3639,10 @@ def _checkout_configs(path: str) -> list[str]:
3639
3639
  return sorted(
3640
3640
  f"config/{item.name}"
3641
3641
  for item in directory.iterdir()
3642
- if item.is_file() and item.suffix in (".yaml", ".yml")
3642
+ if item.is_file()
3643
+ and item.suffix in (".yaml", ".yml")
3644
+ # macOS's AppleDouble companion on a share, not a config
3645
+ and not item.name.startswith("._")
3643
3646
  )
3644
3647
  except OSError:
3645
3648
  return []
@@ -267,6 +267,13 @@ class MainWindow(QMainWindow):
267
267
  # untouched: the heuristic anchors at the start of the text.)
268
268
  self.configure_action.setMenuRole(QAction.MenuRole.NoRole)
269
269
  self.agent_action = self._add(server, "&Start agent", self.toggle_agent)
270
+ # Servers left running by a fleet this console no longer has open: not
271
+ # in the table, so not stoppable from it (#24). Enabled while there
272
+ # are any; the status line names them.
273
+ self.orphans_action = self._add(
274
+ server, "Stop servers &outside this fleet", self.stop_orphans
275
+ )
276
+ self.orphans_action.setEnabled(False)
270
277
  server.addSeparator()
271
278
  # The other half of the same menu: this bench as one of several. A node
272
279
  # has no list — it serves its own devices and drives nobody — so the
@@ -337,13 +344,7 @@ class MainWindow(QMainWindow):
337
344
  header = self.exp_table.horizontalHeader()
338
345
  header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents)
339
346
  header.setSectionResizeMode(EXP_PROGRESS_COLUMN, QHeaderView.ResizeMode.Stretch)
340
- # Source gives way instead of demanding room, as it does on the device
341
- # table. Sized to its contents it is the longest cell in the window —
342
- # a distribution, a version and a commit — and every column here was
343
- # ResizeToContents, so one editable install pushed the whole window
344
- # wider than the screen and there was no dragging it back.
345
- header.setSectionResizeMode(EXP_SOURCE_COLUMN, QHeaderView.ResizeMode.Stretch)
346
- self.exp_table.setTextElideMode(Qt.TextElideMode.ElideRight)
347
+ _source_column(self.exp_table, EXP_SOURCE_COLUMN)
347
348
  self.exp_table.setHorizontalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel)
348
349
  self.exp_table.verticalHeader().setVisible(False)
349
350
  self.exp_table.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows)
@@ -581,7 +582,7 @@ class MainWindow(QMainWindow):
581
582
  self.table.setHorizontalHeaderLabels(COLUMNS)
582
583
  header = self.table.horizontalHeader()
583
584
  header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents)
584
- header.setSectionResizeMode(SOURCE_COLUMN, QHeaderView.ResizeMode.Stretch)
585
+ _source_column(self.table, SOURCE_COLUMN)
585
586
  self.table.itemChanged.connect(self._item_changed)
586
587
  self.table.verticalHeader().setVisible(False)
587
588
  self.table.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows)
@@ -815,6 +816,8 @@ class MainWindow(QMainWindow):
815
816
  item = QTableWidgetItem(text)
816
817
  if column == EXP_STATE_COLUMN:
817
818
  item.setForeground(_tone_brush(self, _state_tone(state)))
819
+ if column == EXP_SOURCE_COLUMN:
820
+ item.setToolTip(text) # the cell elides it
818
821
  self.exp_table.setItem(index, column, item)
819
822
  if selected is not None:
820
823
  self._select_run(*selected)
@@ -1830,6 +1833,8 @@ class MainWindow(QMainWindow):
1830
1833
  item = QTableWidgetItem(value)
1831
1834
  if col == STATE_COLUMN:
1832
1835
  item.setForeground(_tone_brush(self, status.state))
1836
+ if col == SOURCE_COLUMN:
1837
+ item.setToolTip(value) # the cell elides it
1833
1838
  self.table.setItem(row, col, item)
1834
1839
  self._painting = False
1835
1840
  if keep:
@@ -1840,10 +1845,18 @@ class MainWindow(QMainWindow):
1840
1845
  # The agent goes in this line, not one of its own: whether a bench can
1841
1846
  # be reached from another machine is standing information, and the
1842
1847
  # line is repainted every few seconds anyway.
1848
+ orphans = self.bench.orphans()
1849
+ self.orphans_action.setEnabled(bool(orphans))
1843
1850
  parts = [
1844
1851
  _short(self.bench.home.root),
1845
1852
  fleet,
1846
1853
  f"{working}/{len(views)} device(s) in the working fleet",
1854
+ # Said every refresh until they are gone: they hold ports and
1855
+ # instrument sessions the fleet's own devices will need.
1856
+ f"running outside this fleet: {', '.join(orphans)} (Server > Stop servers outside"
1857
+ " this fleet)"
1858
+ if orphans
1859
+ else "",
1847
1860
  self.bench.agent_state(),
1848
1861
  f"refreshed {datetime.now().strftime('%H:%M:%S')}",
1849
1862
  ]
@@ -2358,6 +2371,17 @@ class MainWindow(QMainWindow):
2358
2371
  return
2359
2372
  self._call(lambda: self.bench.start_agent(), then=lambda _s: self._show_agent())
2360
2373
 
2374
+ def stop_orphans(self) -> None:
2375
+ """Server → Stop servers outside this fleet: end what no fleet row can reach (#24)."""
2376
+ names = self.bench.orphans()
2377
+ if not names:
2378
+ return
2379
+
2380
+ def stop_all() -> list[str]:
2381
+ return [name for name in names if self.bench.stop(name)]
2382
+
2383
+ self._call(stop_all, then=lambda _stopped: self.refresh())
2384
+
2361
2385
  def _show_agent(self) -> None:
2362
2386
  """Name the action for what it would now do, and repaint the status line."""
2363
2387
  self.agent_action.setText("S&top agent" if self.bench.agent_running else "&Start agent")
@@ -2464,6 +2488,7 @@ class MainWindow(QMainWindow):
2464
2488
 
2465
2489
  def done(_status: Any) -> None:
2466
2490
  self._starting.discard(name)
2491
+ self._reread_panels(name, host)
2467
2492
  self.refresh()
2468
2493
 
2469
2494
  def failed(message: str) -> None:
@@ -2484,8 +2509,13 @@ class MainWindow(QMainWindow):
2484
2509
  if name is None:
2485
2510
  return
2486
2511
  host = self.selected_host
2487
- self._call(
2488
- (lambda: self.bench.node_stop(host, name)) if host else (lambda: self.bench.stop(name))
2512
+ self._hold_panels(name, host)
2513
+ self._run_then_reread(
2514
+ (lambda: self.bench.node_stop(host, name))
2515
+ if host
2516
+ else (lambda: self.bench.stop(name)),
2517
+ name,
2518
+ host,
2489
2519
  )
2490
2520
 
2491
2521
  def restart_device(self) -> None:
@@ -2494,12 +2524,55 @@ class MainWindow(QMainWindow):
2494
2524
  if name is None:
2495
2525
  return
2496
2526
  host = self.selected_host
2497
- self._call(
2527
+ self._hold_panels(name, host)
2528
+ self._run_then_reread(
2498
2529
  (lambda: self.bench.node_restart(host, name))
2499
2530
  if host
2500
- else (lambda: self.bench.restart(name))
2531
+ else (lambda: self.bench.restart(name)),
2532
+ name,
2533
+ host,
2501
2534
  )
2502
2535
 
2536
+ def _run_then_reread(self, action: Callable[[], Any], name: str, host: str) -> None:
2537
+ """Run a stop or restart, then let the held panels of *name* read again.
2538
+
2539
+ On failure as well as success: a panel left held would refuse every
2540
+ call for good.
2541
+ """
2542
+
2543
+ def done(_result: Any) -> None:
2544
+ self.clear_error()
2545
+ self._reread_panels(name, host)
2546
+ self.refresh()
2547
+
2548
+ def failed(message: str) -> None:
2549
+ self._reread_panels(name, host)
2550
+ self.show_error(message)
2551
+
2552
+ self.worker.run(action, on_done=done, on_error=failed)
2553
+
2554
+ def _open_panel_windows(self, name: str, host: str) -> list[Any]:
2555
+ """The control windows that may hold a panel of *name*, open ones only."""
2556
+ key = f"{host}/{name}" if host else name
2557
+ windows = [self._device_controls.get(key), getattr(self, "_control", None)]
2558
+ return [w for w in windows if w is not None and not getattr(w, "closed", False)]
2559
+
2560
+ def _hold_panels(self, name: str, host: str = "") -> None:
2561
+ """Have every open panel of *name* stop calling a server that is going away (#22)."""
2562
+ key = f"{host}/{name}" if host else name
2563
+ for window in self._open_panel_windows(name, host):
2564
+ window.hold(key)
2565
+
2566
+ def _reread_panels(self, name: str, host: str = "") -> None:
2567
+ """Have every open panel of *name* read the device it now runs as (#22).
2568
+
2569
+ A device can be docked in its own control window and on the wall at
2570
+ once; both read again.
2571
+ """
2572
+ key = f"{host}/{name}" if host else name
2573
+ for window in self._open_panel_windows(name, host):
2574
+ window.reread(key)
2575
+
2503
2576
  def install_device(self) -> None:
2504
2577
  """Device → Install: starts the job and opens its dialog.
2505
2578
 
@@ -2549,9 +2622,9 @@ class MainWindow(QMainWindow):
2549
2622
  if not dialogs.confirm(
2550
2623
  self,
2551
2624
  "Clear log",
2552
- f"Empty the log of {name}?\n\n"
2625
+ f"Start a new, empty log for {name}?\n\n"
2553
2626
  "This also clears the Traffic tab, which is read out of the same file. "
2554
- "A running server carries on writing into it.",
2627
+ "A running server carries on in the new file; the old one stays in logs/.",
2555
2628
  ):
2556
2629
  return
2557
2630
  self._call(
@@ -2614,7 +2687,8 @@ class MainWindow(QMainWindow):
2614
2687
 
2615
2688
  key = f"{host}/{name}" if host else name
2616
2689
  existing = self._device_controls.get(key)
2617
- if existing is None:
2690
+ # a closed one's panels are spent (#22)
2691
+ if existing is None or getattr(existing, "closed", False):
2618
2692
  existing = ControlWindow(self.bench, self, title=f"{name} — {host}" if host else name)
2619
2693
  self._device_controls[key] = existing
2620
2694
  return existing
@@ -2631,7 +2705,8 @@ class MainWindow(QMainWindow):
2631
2705
  from plesty.server.view.control import ControlWindow
2632
2706
 
2633
2707
  existing = getattr(self, "_control", None)
2634
- if existing is None:
2708
+ # a closed one's panels are spent (#22)
2709
+ if existing is None or getattr(existing, "closed", False):
2635
2710
  existing = ControlWindow(self.bench, self)
2636
2711
  self._control = existing
2637
2712
  return existing
@@ -2844,6 +2919,29 @@ def _short(path: Any) -> str:
2844
2919
  return str(path)
2845
2920
 
2846
2921
 
2922
+ #: Starting width of a Source column, in pixels: enough for a name and a
2923
+ #: version, not for a commit and a local tag.
2924
+ SOURCE_WIDTH = 240
2925
+
2926
+
2927
+ def _source_column(table: QTableWidget, column: int) -> None:
2928
+ """Size a Source column by hand, never by its contents (#25).
2929
+
2930
+ Source is the longest cell in the window — a distribution, a version and a
2931
+ commit. Sized to its contents it pushed the window wider than the screen;
2932
+ as ``Stretch`` it took what the other columns left and could not be dragged
2933
+ at all. It starts at :data:`SOURCE_WIDTH`, the operator drags it from there,
2934
+ the cell elides and its tooltip carries the full text, and the last column
2935
+ takes up whatever width is spare.
2936
+ """
2937
+ header = table.horizontalHeader()
2938
+ header.setSectionResizeMode(column, QHeaderView.ResizeMode.Interactive)
2939
+ header.resizeSection(column, SOURCE_WIDTH)
2940
+ header.setStretchLastSection(True)
2941
+ table.setTextElideMode(Qt.TextElideMode.ElideRight)
2942
+ table.setHorizontalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel)
2943
+
2944
+
2847
2945
  def _clock(stamp: str | None) -> str:
2848
2946
  """``HH:MM:SS`` of an ISO timestamp (local time), or ``""``."""
2849
2947
  if not stamp:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plesty-server"
3
- version = "0.4.2"
3
+ version = "0.4.3"
4
4
  license = "LGPL-3.0-or-later"
5
5
  license-files = ["LICENSE", "LICENSES/*"]
6
6
  description = "The PLESTY bench application: installs, runs and field-tests device servers."
@@ -9,8 +9,8 @@ maintainers = [{ name = "Plesty Development Team", email = "plesty.dev@example.c
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
11
11
  dependencies = [
12
- "plesty-bench==0.4.2",
13
- "plesty-lib[report]>=0.5.0",
12
+ "plesty-bench==0.4.3",
13
+ "plesty-lib[report]>=0.5.2",
14
14
  "pyyaml>=6.0",
15
15
  "pyzmq>=26",
16
16
  "click>=8.1",
@@ -18,7 +18,7 @@ dependencies = [
18
18
 
19
19
  [project.optional-dependencies]
20
20
  gui = [
21
- "plesty-lib[gui]>=0.5.0",
21
+ "plesty-lib[gui]>=0.5.2",
22
22
  "pyside6==6.11.2",
23
23
  ]
24
24
 
File without changes
File without changes