Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/drunc/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Callable, List, TypeVar

from daqpytools.logging.handlers import LogHandlerConf
from daqpytools.logging.logger import setup_daq_ers_logger
from druncschema.authoriser_pb2 import ActionType, SystemType
from druncschema.broadcast_pb2 import BroadcastType
from druncschema.controller_pb2 import (
Expand Down Expand Up @@ -86,7 +87,8 @@ def __init__(self, configuration, name: str, session: str, token: Token):
self.broadcast_service = None
self.monitoring_metrics = ControllerMonitoringMetrics()
self.handlerconf = LogHandlerConf(init_ers=True)
self.log = get_logger(f"controller.core.{name}_ctrl", ers_kafka_handler=False)
self.log = get_logger(f"controller.core.{name}_ctrl")
setup_daq_ers_logger(self.log, session)
log_init = get_logger("controller.core.__init__")
log_init.info(f"Initialising controller '{name}' with session '{session}'")

Expand Down
7 changes: 3 additions & 4 deletions src/drunc/process_manager/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import threading
import time

from daqpytools.logging.handlers import HandlerType, LogHandlerConf
from daqpytools.logging.handlers import LogHandlerConf
from daqpytools.logging.logger import setup_daq_ers_logger
from druncschema.authoriser_pb2 import ActionType, SystemType
from druncschema.broadcast_pb2 import BroadcastType
from druncschema.description_pb2 import CommandDescription, Description
Expand Down Expand Up @@ -64,8 +65,8 @@ def __init__(
self.handlerconf = LogHandlerConf(init_ers=True)
self.log = get_logger(
f"process_manager.{configuration.get_data_type_name()}_process_manager",
ers_kafka_handler=False,
)
setup_daq_ers_logger(self.log, session)
self.log.debug(pid_info_str())
self.log.debug("Initialized ProcessManager")

Expand Down Expand Up @@ -227,8 +228,6 @@ def find_by_uuid(pi_list, target_uuid: str):
continue
pi = find_by_uuid(results, diff)
err_msg = f"Process {pi.process_description.metadata.name} with UUID {pi.uuid.uuid} has died with a return code {pi.return_code}"
# easiest way to send one to Rich and ERS
self.log.critical(err_msg, extra={"handlers": [HandlerType.Rich]})
Comment on lines -230 to -231
Copy link
Contributor Author

@emmuhamm emmuhamm Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prevents duplication of messages. It will use whatever is defined in ERS now

self.log.critical(err_msg, extra=self.handlerconf.ERS)

time.sleep(interval_s)
Expand Down
14 changes: 8 additions & 6 deletions tests/process_manager/test_process_manager_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,20 @@ def grpc_servicer(mock_logger, monkeypatch):
# Injecting them in the test
monkeypatch.setenv(
"DUNEDAQ_ERS_ERROR",
"erstrace,throttle,lstdout,protobufstream(monkafka.cern.ch:30092)",
)
monkeypatch.setenv(
"DUNEDAQ_ERS_FATAL", "erstrace,lstdout,protobufstream(monkafka.cern.ch:30092)"
"rich",
)
monkeypatch.setenv("DUNEDAQ_ERS_FATAL", "rich")
monkeypatch.setenv(
"DUNEDAQ_ERS_INFO",
"erstrace,throttle,lstdout,protobufstream(monkafka.cern.ch:30092)",
"rich",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to simplify the tests a bit; removed dependency on anything kafka related in this test

)
monkeypatch.setenv(
"DUNEDAQ_ERS_WARNING",
"erstrace,throttle,lstdout,protobufstream(monkafka.cern.ch:30092)",
"rich",
)
monkeypatch.setattr(
"drunc.process_manager.process_manager.setup_daq_ers_logger",
lambda *args, **kwargs: None,
)

servicer = ConcreteProcessManager(session="mock_session")
Expand Down
Loading