Skip to content

Commit

Permalink
Merge pull request #311 from DUNE-DAQ/plasorak/controller-configurati…
Browse files Browse the repository at this point in the history
…on-segment-lookup

Controller configuration segment lookup fix
  • Loading branch information
wanyunSu authored Nov 20, 2024
2 parents e379a66 + 9bf7234 commit 7727fd4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/drunc/controller/children_interface/child_node.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import abc
from drunc.exceptions import DruncSetupException
from drunc.utils.utils import ControlType, get_control_type_and_uri_from_connectivity_service, get_control_type_and_uri_from_cli
import logging
from drunc.utils.grpc_utils import pack_to_any
from druncschema.token_pb2 import Token
from druncschema.request_response_pb2 import Response, ResponseFlag, Description
Expand Down Expand Up @@ -61,7 +62,7 @@ def describe(self, token:Token) -> Response:
name = descriptionName,
endpoint = self.get_endpoint(),
info = get_detector_name(self.configuration),
session = os.getenv("DUNEDAQ_SESSION"),
session = os.getenv("DUNEDAQ_SESSION"),
commands = None,
broadcast = None,
)
Expand All @@ -78,15 +79,15 @@ def describe(self, token:Token) -> Response:

@staticmethod
def get_child(name:str, cli, configuration, init_token=None, connectivity_service=None, **kwargs):
log = logging.getLogger("ChildNode.get_child")

from drunc.utils.configuration import ConfTypes
log.info(f"Setting up child '{name}'")

ctype = ControlType.Unknown
uri = None
if connectivity_service:
ctype, uri = get_control_type_and_uri_from_connectivity_service(connectivity_service, name, timeout=60)
import logging
log = logging.getLogger("ChildNode.get_child")

if ctype == ControlType.Unknown:
ctype, uri = get_control_type_and_uri_from_cli(cli)
Expand Down
5 changes: 3 additions & 2 deletions src/drunc/controller/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def find_segment(segment, id):
return segment

for child_segment in segment.segments:
if ControllerConfHandler.find_segment(child_segment, id) is not None:
return child_segment
segment = ControllerConfHandler.find_segment(child_segment, id)
if segment is not None:
return segment

return None

Expand Down
2 changes: 1 addition & 1 deletion src/drunc/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, configuration, name:str, session:str, token:Token):

from logging import getLogger
self.logger = getLogger('Controller')

self.logger.info(f'Initialising controller \'{name}\' with session \'{session}\'')
self.configuration = configuration

from drunc.broadcast.server.configuration import BroadcastSenderConfHandler
Expand Down

0 comments on commit 7727fd4

Please sign in to comment.