How kphanipavan/harmoney works
Main Components
• Client: Initiates function calls using harmoney/client.py.
• Broker: Acts as the mediator (using harmoney/router.py) that handles connection management and load balancing between clients and runners.
• Runner: Executes the requested functions (using harmoney/runner.py) and returns results.
• (Optionally) Utility/helper layers: Indicate support modules like harmoney/_callSpec.py, which may be used for validating or specifying function call details.
• External Dependencies/Technologies: These include the networking layer (websockets), FastAPI (for creating the broker’s service), Uvicorn (for serving the API), Requests, and Pydantic for data validation.
Relationships and Interactions
• The Client sends a request (via cli.runSingle) to the Broker.
• The Broker (router) listens on a specific IP/port, routing the request to one or more connected Runners.
• Runners (via run.startRunner) register and listen for assigned tasks. They execute the function (e.g., “custFn”) and return the result back to the Broker.
• The Broker then forwards the result back to the Client.
Architectural Patterns and Design Principles
• Distributed System Design: The framework separates concerns by decoupling client requests from the execution environment.
• Message Routing/Load Balancing: Broker is central to handling incoming requests and distributing them to available Runners.
• Asynchronous Communication: Although not fully detailed in the current README, dependencies (websockets, FastAPI, and Uvicorn) suggest an asynchronous event-driven architecture.
• Loose Coupling & Extensibility: The design allows the addition of multiple runners and the possibility to extend functionality by altering individual components.
Important Details to Capture
• Network topology, such as indicating the IP and port configuration (shown in the README example) for better visual understanding.
• Anticipated improvements or TODO aspects (like enhanced error handling and dependency refinements), if relevant for planning extensions.