fix graph and white background added
This commit is contained in:
@@ -80,6 +80,9 @@ class PipelineController:
|
||||
self._raw_reader: ShmRingReader | None = None
|
||||
self._pre_reader: ShmRingReader | None = None
|
||||
self._result_reader: ShmRingReader | None = None
|
||||
# Results read anywhere (polling, Stop/pause drains, snapshots) await display;
|
||||
# the next poll shows the newest acquisition, not merely the last one read.
|
||||
self._display_pending = False
|
||||
self.active_config: RunConfigModel | None = None
|
||||
self.active_config_path: Path | None = None
|
||||
self.stop_generation = 0
|
||||
@@ -203,6 +206,7 @@ class PipelineController:
|
||||
raise error
|
||||
if not operation.valid:
|
||||
raise InterruptedError("Pipeline operation cancelled")
|
||||
self._display_pending = False # the pausing operation owns the display
|
||||
return operation
|
||||
except BaseException:
|
||||
operation.finish(resume=False)
|
||||
@@ -478,11 +482,14 @@ class PipelineController:
|
||||
finally:
|
||||
if self.single_capture_active:
|
||||
self._check_single_capture_deadline()
|
||||
elif latest[2] is not None:
|
||||
self._restart_count = 0
|
||||
started = time.monotonic_ns()
|
||||
self.plots.draw(latest[2])
|
||||
self.metrics.record("rendering", time.monotonic_ns() - started)
|
||||
elif self._display_pending:
|
||||
if latest[2] is not None:
|
||||
self._restart_count = 0 # results flow again
|
||||
self._display_pending = False
|
||||
if self.history.results:
|
||||
started = time.monotonic_ns()
|
||||
self.plots.draw(self.history.results[-1])
|
||||
self.metrics.record("rendering", time.monotonic_ns() - started)
|
||||
except Exception as exc:
|
||||
self._report_ui_error("Result display", exc)
|
||||
|
||||
@@ -634,6 +641,7 @@ class PipelineController:
|
||||
self.metrics.record("processing", collection.processing_duration_ns)
|
||||
if self.history.record_result(collection):
|
||||
self.recording.record("results", collection)
|
||||
self._display_pending = True
|
||||
latest = collection
|
||||
return latest
|
||||
|
||||
@@ -662,17 +670,20 @@ class PipelineController:
|
||||
stable = 0 if self.drain_once() else stable + 1
|
||||
self.pump_events(poll_s)
|
||||
|
||||
def drain_results(self, *, timeout_s: float, poll_s: float) -> ResultCollection | None:
|
||||
deadline, stable = time.monotonic() + timeout_s, 0
|
||||
latest_seen = None
|
||||
while self._result_reader is not None and time.monotonic() < deadline and (latest_seen is None or stable < 2):
|
||||
latest = self.read_results()
|
||||
if latest is not None:
|
||||
latest_seen, stable = latest, 0
|
||||
elif latest_seen is not None:
|
||||
def drain_results(self, *, timeout_s: float, poll_s: float, revision: int | None = None) -> None:
|
||||
"""Read results until the timeout; stop two quiet polls after results arrive or,
|
||||
given a revision, as soon as the newest result carries it."""
|
||||
deadline, seen, stable = time.monotonic() + timeout_s, False, 0
|
||||
while self._result_reader is not None and time.monotonic() < deadline:
|
||||
if self.read_results() is not None:
|
||||
seen, stable = True, 0
|
||||
elif seen:
|
||||
stable += 1
|
||||
if revision is None and stable >= 2:
|
||||
return
|
||||
if revision is not None and self.history.results and self.history.results[-1].settings_revision == revision:
|
||||
return
|
||||
self.pump_events(poll_s)
|
||||
return latest_seen
|
||||
|
||||
def drain_snapshot(self) -> None:
|
||||
initial_readers = self.readers
|
||||
|
||||
Reference in New Issue
Block a user