Server
This module provides a FastAPI server for managing commands and replies in a distributed system.
ATTRIBUTE | DESCRIPTION |
---|---|
PORT |
The port number for the FastAPI server.
TYPE:
|
HOST |
The host address for the FastAPI server.
TYPE:
|
FUNCTION | DESCRIPTION |
---|---|
place_command |
Place a command in the outbound queue. |
place_reply |
Place a reply in the outbound queue. |
start_server |
Start the FastAPI server if it is not already running. |
Documentation last updated: 2025-06-11
Command
Bases: BaseModel
Request model for the FastAPI server.
Reply
Bases: BaseModel
Reply model for the FastAPI server.
clear_commands
Clear the commands in the outbound queue.
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary indicating the status of the clear operation.
TYPE:
|
clear_commands_target
Clear the commands in the outbound queue for a specific target.
PARAMETER | DESCRIPTION |
---|---|
target
|
The target worker to clear the commands for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary indicating the status of the clear operation.
TYPE:
|
clear_replies
Clear the replies in the outbound queue.
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary indicating the status of the clear operation.
TYPE:
|
clear_replies_target
Clear the replies in the outbound queue for a specific request_id.
PARAMETER | DESCRIPTION |
---|---|
request_id
|
The request ID to clear the reply for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary indicating the status of the clear operation.
TYPE:
|
commands
Get the commands in the outbound queue.
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary containing the outbound commands.
TYPE:
|
get_command
get_command(target: str) -> Command
Get a command from the hub.
PARAMETER | DESCRIPTION |
---|---|
target
|
The target worker to get the command for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Command
|
The command for the specified target worker.
TYPE:
|
get_reply
get_reply(request_id: str) -> Reply
Get a command from the hub.
PARAMETER | DESCRIPTION |
---|---|
request_id
|
The request ID to get the reply for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Reply
|
The reply for the specified request ID.
TYPE:
|
place_command
place_command(command: Command) -> str
Place a command in the outbound queue.
PARAMETER | DESCRIPTION |
---|---|
command
|
The command to place in the outbound queue.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The request ID of the command.
TYPE:
|
place_reply
place_reply(reply: Reply) -> str
Place a reply in the outbound queue.
PARAMETER | DESCRIPTION |
---|---|
reply
|
The reply to place in the outbound queue.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The reply ID of the reply.
TYPE:
|
read_root
Root endpoint for the FastAPI server.
RETURNS | DESCRIPTION |
---|---|
dict
|
A simple greeting message.
TYPE:
|
register_model
Register the model with the hub.
PARAMETER | DESCRIPTION |
---|---|
target
|
The target worker to register.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary containing the list of registered workers.
TYPE:
|
registry
See the registry of workers.
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary containing the worker registry.
TYPE:
|
replies
Get the replies in the outbound queue.
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary containing the outbound replies.
TYPE:
|
send_command
send_command(command: Command) -> dict
Send a command to the hub.
PARAMETER | DESCRIPTION |
---|---|
command
|
The command to send.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary containing the request ID of the command.
TYPE:
|