Skip to content

Commit 1690f5b

Browse files
author
Elias Werner
committed
fixes in jpeg export, reload_ext function
1 parent b72b0a7 commit 1690f5b

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

jumper_extension/adapters/visualizer/backends/plotly.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,20 @@ def _render_direct_plot(
309309
".jpeg"
310310
):
311311
save_jpeg += ".jpg"
312-
fig.write_image(save_jpeg, format="jpeg", scale=2)
313-
print(f"Plot saved as JPEG: {save_jpeg}")
312+
try:
313+
fig.write_image(save_jpeg, format="jpeg", scale=2)
314+
print(f"Plot saved as JPEG: {save_jpeg}")
315+
except Exception as e:
316+
logger.warning(
317+
"Failed to save JPEG to %s: %s. "
318+
"JPEG export requires a working Chrome/Chromium for kaleido. "
319+
"If you are on Linux with snap-installed Chromium, the snap "
320+
"sandbox often blocks kaleido; try running `choreo_get_chrome` "
321+
"once to install a known-working Chrome, or install a non-snap "
322+
"Chrome/Chromium build.",
323+
save_jpeg,
324+
e,
325+
)
314326

315327
if pickle_file:
316328
if not pickle_file.endswith(".pkl"):

jumper_extension/monitor/backends/thread/monitor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ def start(self, interval: float = 1.0):
187187
)
188188

189189
def stop(self):
190+
if self.start_time is None:
191+
self.running = False
192+
return
190193
self.running = False
191194
if hasattr(self, "_stop_event"):
192195
self._stop_event.set()

jumper_extension/utilities.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ def filter_perfdata(cell_history_data, perfdata, compress_idle=True):
1818
if cell_history_data is None or cell_history_data.empty:
1919
return perfdata.iloc[0:0]
2020

21-
# Guard against perfdata collected before the time column was introduced
21+
# Guard against perfdata collected before the time column was introduced.
22+
# Stay silent when perfdata is empty — that just means no samples were
23+
# collected yet (e.g. monitor not running or cells too short) and the
24+
# downstream "no performance data" message already covers it.
2225
if "time" not in perfdata.columns:
23-
logger.warning("[JUmPER]: perfdata is missing 'time' column")
26+
if not perfdata.empty:
27+
logger.warning("[JUmPER]: perfdata is missing 'time' column")
2428
return perfdata.iloc[0:0]
2529

2630
if compress_idle:

0 commit comments

Comments
 (0)