mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-20 08:20:02 +02:00
updates Server docstring
This commit is contained in:
parent
36a8e916f6
commit
bb4de988e9
@ -78,13 +78,12 @@ class Server:
|
||||
"""
|
||||
The `Server` class provides a flexible server implementation for the `DataService`.
|
||||
|
||||
Parameters:
|
||||
-----------
|
||||
Args:
|
||||
service: DataService
|
||||
The DataService instance that this server will manage.
|
||||
host: str
|
||||
The host address for the server. Default is '0.0.0.0', which means all available
|
||||
network interfaces.
|
||||
The host address for the server. Default is '0.0.0.0', which means all
|
||||
available network interfaces.
|
||||
rpc_port: int
|
||||
The port number for the RPC server. Default is 18871.
|
||||
web_port: int
|
||||
@ -98,13 +97,12 @@ class Server:
|
||||
use_forking_server: bool
|
||||
Whether to use ForkingServer for multiprocessing. Default is False.
|
||||
additional_servers : list[AdditionalServer]
|
||||
A list of additional servers to run alongside the main server. Each entry in the
|
||||
list should be a dictionary with the following structure:
|
||||
|
||||
A list of additional servers to run alongside the main server. Each entry in
|
||||
the list should be a dictionary with the following structure:
|
||||
- server: A class that adheres to the AdditionalServerProtocol. This class
|
||||
should have an `__init__` method that accepts the DataService instance,
|
||||
port, host, and optional keyword arguments, and a `serve` method that is a
|
||||
coroutine responsible for starting the server.
|
||||
port, host, and optional keyword arguments, and a `serve` method that is
|
||||
a coroutine responsible for starting the server.
|
||||
- port: The port on which the additional server will be running.
|
||||
- kwargs: A dictionary containing additional keyword arguments that will be
|
||||
passed to the server's `__init__` method.
|
||||
@ -115,14 +113,14 @@ class Server:
|
||||
>>> class MyCustomServer:
|
||||
... def __init__(
|
||||
... self,
|
||||
... service: DataService,
|
||||
... port: int,
|
||||
... data_service_observer: DataServiceObserver,
|
||||
... host: str,
|
||||
... state_manager: StateManager,
|
||||
... **kwargs: Any
|
||||
... ):
|
||||
... self.service = service
|
||||
... self.state_manager = state_manager
|
||||
... port: int,
|
||||
... **kwargs: Any,
|
||||
... ) -> None:
|
||||
... self.observer = data_service_observer
|
||||
... self.state_manager = self.observer.state_manager
|
||||
... self.service = self.state_manager.service
|
||||
... self.port = port
|
||||
... self.host = host
|
||||
... # handle any additional arguments...
|
||||
@ -130,8 +128,8 @@ class Server:
|
||||
... async def serve(self):
|
||||
... # code to start the server...
|
||||
|
||||
And here's how you might add it to the `additional_servers` list when creating a
|
||||
`Server` instance:
|
||||
And here's how you might add it to the `additional_servers` list when creating
|
||||
a `Server` instance:
|
||||
|
||||
>>> server = Server(
|
||||
... service=my_data_service,
|
||||
|
Loading…
x
Reference in New Issue
Block a user