diff --git a/src/daq/jobs/healthcheck.py b/src/daq/jobs/healthcheck.py index e2baef4..a2c0518 100644 --- a/src/daq/jobs/healthcheck.py +++ b/src/daq/jobs/healthcheck.py @@ -70,7 +70,7 @@ class DAQJobHealthcheck(DAQJob): def __init__(self, config: DAQJobHealthcheckConfig, **kwargs): super().__init__(config, **kwargs) - from daq.types import ALL_DAQ_JOBS, get_daq_job_class + from daq.types import get_all_daq_job_types, get_daq_job_class self._get_daq_job_class = get_daq_job_class self._current_stats = {} @@ -78,7 +78,7 @@ def __init__(self, config: DAQJobHealthcheckConfig, **kwargs): self._healthcheck_stats = [] if config.enable_alerts_on_restart: - for daq_job_type_class in ALL_DAQ_JOBS: + for daq_job_type_class in get_all_daq_job_types(): self._healthcheck_stats.append( HealthcheckStatsItem( alert_info=DAQAlertInfo( diff --git a/src/daq/types.py b/src/daq/types.py index 3ebfcc4..b3291ef 100644 --- a/src/daq/types.py +++ b/src/daq/types.py @@ -14,7 +14,9 @@ from daq.jobs.test_job import DAQJobTest from utils.subclasses import all_subclasses -ALL_DAQ_JOBS = all_subclasses(DAQJob) + +def get_all_daq_job_types(): + return all_subclasses(DAQJob) DAQ_JOB_TYPE_TO_CLASS: dict[str, type[DAQJob]] = { @@ -42,7 +44,7 @@ def get_daq_job_class( f"DAQ job type '{daq_job_type}' is deprecated, please use '{daq_job_class.__name__}' instead" ) else: - for daq_job in ALL_DAQ_JOBS: + for daq_job in get_all_daq_job_types(): if daq_job.__name__ == daq_job_type: daq_job_class = daq_job return daq_job_class