Skip to content
Snippets Groups Projects
Commit d3fc5e37 authored by Daniel CARRON's avatar Daniel CARRON :b:
Browse files

Fixed resource monitoring

parent 56c2160e
No related branches found
No related tags found
No related merge requests found
Pipeline #75858 failed
...@@ -342,8 +342,10 @@ def _monitor_worker( ...@@ -342,8 +342,10 @@ def _monitor_worker(
ra.acc() # guarantees at least an entry will be available ra.acc() # guarantees at least an entry will be available
if summary_event.is_set(): if summary_event.is_set():
queue.put(ra.summary()) summary = ra.summary().copy()
  • Owner

    @dcarron: not sure what happened here, but this stopped working for me. Why are you copying the summary? This is an interprocess communication queue - the data is always copied.

  • Owner

    Ah - was the summary container being deleted by the Q?

  • Author Maintainer

    Yes, the self.q.get() in checkpoint() was getting a summary with all metrics set to 0, although the values were set when it was put inside the queue.

    Edited by Daniel CARRON
  • Please register or sign in to reply
queue.put(summary)
ra.clear() ra.clear()
print(queue.get())
  • Owner

    You also seem to have left a print() statement dangling here.

  • Owner

    Removing the print statement makes the thing work for me again.

  • Author Maintainer

    Sorry about the print statement, sometimes vscode is acting weird when trying to save something when ssh-ing from home.

  • Owner

    It is alright.

  • Please register or sign in to reply
summary_event.clear() summary_event.clear()
time.sleep(interval) time.sleep(interval)
...@@ -416,7 +418,6 @@ class ResourceMonitor: ...@@ -416,7 +418,6 @@ class ResourceMonitor:
"""Forces the monitoring process to yield data and clear the internal """Forces the monitoring process to yield data and clear the internal
accumlator.""" accumlator."""
self.summary_event.set() self.summary_event.set()
try: try:
data: dict[str, list[int | float]] = self.q.get( data: dict[str, list[int | float]] = self.q.get(
timeout=2 * self.interval timeout=2 * self.interval
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment