Skip to content

child_controller

drunc.grpc_testing_tools.child_controller

ChildController Service Implementation

Provides the gRPC servicer implementation for ChildController services, which act as leaf nodes in the system hierarchy, handling specific tasks and reporting to the RootController.

Classes

ChildControllerServiceImpl(name)

Bases: ChildControllerServiceServicer

Implementation of ChildController gRPC service.

ChildController services are leaf nodes that handle specific tasks while maintaining connections to their RootController. Each child has a unique name identifier and handles connectivity testing, instruction processing, and graceful shutdown requests.

Initialise the ChildController service implementation.

Parameters:

Name Type Description Default
name str

Unique identifier for this child controller instance

required
Source code in drunc/grpc_testing_tools/child_controller.py
def __init__(self, name: str):
    """
    Initialise the ChildController service implementation.

    Args:
        name: Unique identifier for this child controller instance
    """
    self.name = name
Functions
MakeRequest(request, context)

Handle incoming connectivity test requests.

Parameters:

Name Type Description Default
request

DummyRequest containing message and timestamp

required
context

gRPC context object

required

Returns:

Type Description

DummyResponse with echoed message confirming ChildController is responsive

Source code in drunc/grpc_testing_tools/child_controller.py
def MakeRequest(self, request, context):
    """
    Handle incoming connectivity test requests.

    Args:
        request: DummyRequest containing message and timestamp
        context: gRPC context object

    Returns:
        DummyResponse with echoed message confirming ChildController is responsive
    """
    return DummyResponse(reply=f"{self.name} server response: {request.message}")