Skip to content

Commit

Permalink
extent describe
Browse files Browse the repository at this point in the history
  • Loading branch information
plasorak committed Sep 17, 2024
1 parent 9755128 commit 0f3a13f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/drunc/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def __init__(self, configuration, name:str, session:str, token:Token, applicatio

self.application_registry = None
self.application_registry_thread = None
self.uri = ''

if application_registry_endpoint:
from drunc.application_registry.client import ApplicationRegistryClient
Expand Down Expand Up @@ -260,7 +261,7 @@ def construct_error_node_response(self, command_name:str, token:Token) -> Respon
)

def advertise_control_address(self, address, raise_on_missing_registry=False):
my_address = f'grpc://{address}'
self.uri = f'grpc://{address}'

if not self.application_registry:
from drunc.application_registry.client import ApplicationRegistryNotPresent
Expand All @@ -270,7 +271,7 @@ def advertise_control_address(self, address, raise_on_missing_registry=False):
self.logger.info(f'Registering myself to the application registry')
self.application_registry.register(
name = self.name,
address = my_address
address = self.uri
)
from threading import Thread
self.running = True
Expand Down Expand Up @@ -517,20 +518,31 @@ def describe(self) -> Response:
from drunc.utils.grpc_utils import pack_to_any
bd = self.describe_broadcast()
d = Description(
endpoint = self.uri,
type = 'controller',
name = self.name,
session = self.session,
commands = self.commands,
children_endpoints = [child.get_endpoint() for child in self.children_nodes],
)

if bd:
d.broadcast.CopyFrom(pack_to_any(bd))


response_children = self.propagate_to_list(
'describe',
command_data = None,
token = token,
node_to_execute = self.children_nodes
)

return Response (
name = self.name,
token = None,
data = pack_to_any(d),
flag = ResponseFlag.EXECUTED_SUCCESSFULLY,
children = [],
children = response_children,
)

# ORDER MATTERS!
Expand Down

0 comments on commit 0f3a13f

Please sign in to comment.