Skip to content

Commit

Permalink
Cleaning up unified_shell
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelPlesniak committed Dec 10, 2024
1 parent 4f9c6c5 commit 137eb5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/drunc/unified_shell/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def boot(
if not result: break
log.debug(f'\'{result.data.process_description.metadata.name}\' ({result.data.uuid.uuid}) process started')
except InterruptedCommand:
log.warning("booting interrupted")
log.warning("Booting interrupted")
return

controller_address = obj.get_driver('process_manager').controller_address
Expand Down
14 changes: 3 additions & 11 deletions src/drunc/unified_shell/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ def create_drivers(self, **kwargs) -> Mapping[str, GRPCDriver]:
self._token,
aio_channel = True,
)

if self.address_controller != '':
from drunc.controller.controller_driver import ControllerDriver
ret['controller'] = ControllerDriver(
self.address,
self._token,
aio_channel = False,
)

return ret

def set_controller_driver(self, address_controller, **kwargs) -> None:
self.log.debug("Setting controller address")
self.address_controller = address_controller

from drunc.controller.controller_driver import ControllerDriver

self._drivers['controller'] = ControllerDriver(
self.address_controller,
self._token,
Expand All @@ -63,23 +59,20 @@ def create_token(self, **kwargs) -> Token:
from drunc.utils.shell_utils import create_dummy_token_from_uname
return create_dummy_token_from_uname()


def start_listening_pm(self, broadcaster_conf):
def start_listening_pm(self, broadcaster_conf) -> None:
self.log.debug("Listening to the pm")
from drunc.broadcast.client.broadcast_handler import BroadcastHandler
from drunc.broadcast.client.configuration import BroadcastClientConfHandler
from drunc.utils.configuration import ConfTypes
# self.log.error("Started liostending toj pm")
bcch = BroadcastClientConfHandler(
type = ConfTypes.ProtobufAny,
data = broadcaster_conf,
)

self.status_receiver_pm = BroadcastHandler(
broadcast_configuration = bcch
)

def start_listening_controller(self, broadcaster_conf):
def start_listening_controller(self, broadcaster_conf) -> None:
self.log.debug("Listening to the controller")
from drunc.broadcast.client.broadcast_handler import BroadcastHandler
from drunc.broadcast.client.configuration import BroadcastClientConfHandler
Expand All @@ -92,11 +85,10 @@ def start_listening_controller(self, broadcaster_conf):
broadcast_configuration = bcch
)

def terminate(self):
def terminate(self) -> None:
self.log.debug("Terminating")
if self.status_receiver_pm:
self.status_receiver_pm.stop()

if self.status_receiver_controller:
self.status_receiver_controller.stop()

0 comments on commit 137eb5f

Please sign in to comment.