Skip to content

Commit

Permalink
feat: add store prefix to DAQJobHandleStats
Browse files Browse the repository at this point in the history
  • Loading branch information
furkan-bilgin committed Nov 14, 2024
1 parent 14aaee9 commit 2007773
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/daq/jobs/handle_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ def unpack_record(record: DAQJobStatsRecord):
]
)

if message.daq_job_info and message.daq_job_info.supervisor_config:
prefix = message.daq_job_info.supervisor_config.supervisor_id
else:
prefix = None

self._put_message_out(
DAQJobMessageStore(
store_config=self.config.store_config,
keys=keys,
data=data_to_send,
prefix=prefix,
)
)

Expand Down
18 changes: 16 additions & 2 deletions src/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
start_daq_jobs,
)
from daq.jobs.handle_stats import DAQJobMessageStats, DAQJobStatsDict
from daq.models import DAQJobConfig, DAQJobMessage, DAQJobStats
from daq.models import DAQJobConfig, DAQJobInfo, DAQJobMessage, DAQJobStats
from daq.store.base import DAQJobStore
from models import SupervisorConfig

Expand Down Expand Up @@ -137,7 +137,12 @@ def get_supervisor_messages(self):
messages = []

# Send stats message
messages.append(DAQJobMessageStats(stats=self.daq_job_stats))
messages.append(
DAQJobMessageStats(
stats=self.daq_job_stats,
daq_job_info=self._get_supervisor_daq_job_info(),
)
)
return messages

def get_daq_job_stats(
Expand Down Expand Up @@ -208,3 +213,12 @@ def _load_supervisor_config(self):

with open(SUPERVISOR_CONFIG_FILE_PATH, "rb") as f:
return msgspec.toml.decode(f.read(), type=SupervisorConfig)

def _get_supervisor_daq_job_info(self):
return DAQJobInfo(
daq_job_type="Supervisor",
daq_job_class_name="Supervisor",
supervisor_config=self.config,
unique_id=self.config.supervisor_id,
instance_id=0,
)

0 comments on commit 2007773

Please sign in to comment.