Skip to content

Commit

Permalink
feat: add supervisor_id property and include supervisor_id in PC metr…
Browse files Browse the repository at this point in the history
…ics message
  • Loading branch information
furkan-bilgin committed Dec 27, 2024
1 parent 01301a8 commit 008a3d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/enrgdaq/daq/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ def __del__(self):
self._logger.info("DAQ job is being deleted")
self._has_been_freed = True

@property
def supervisor_id(self):
return self.info.supervisor_config.supervisor_id

def free(self):
if self._has_been_freed:
return
Expand Down
2 changes: 2 additions & 0 deletions src/enrgdaq/daq/jobs/pc_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def _poll_metrics(self):
if PCMetric.DISK in self.config.metrics_to_store:
data[PCMetric.DISK] = psutil.disk_usage("/").percent

data = {k.value: v for k, v in data.items()}
self._send_store_message(data)

def _send_store_message(self, data: dict):
Expand All @@ -73,6 +74,7 @@ def _send_store_message(self, data: dict):
self._put_message_out(
DAQJobMessageStoreTabular(
store_config=self.config.store_config,
tag=self._supervisor_config.supervisor_id,
keys=keys,
data=[values],
)
Expand Down

0 comments on commit 008a3d9

Please sign in to comment.