osbrain.nameserver
— osBrain nameserver logic¶
Implementation of name server.
-
class
osbrain.nameserver.
NameServer
(*args, **kwargs)¶ Bases:
Pyro4.naming.NameServer
-
agents
()¶ List agents registered in the name server.
-
async_kill_agents
(nsaddr)¶ Kill all agents registered in the name server, with no mercy.
-
async_shutdown_agents
(nsaddr)¶ Shutdown all agents registered in the name server.
-
daemon_shutdown
()¶ Shutdown the name server daemon.
-
ping
()¶ A simple test method to check if the name server is running correctly.
-
-
class
osbrain.nameserver.
NameServerProcess
(addr=None, base=<class 'osbrain.nameserver.NameServer'>)¶ Bases:
multiprocessing.context.Process
Name server class. Instances of a name server are system processes which can be run independently.
-
agents
()¶ List agents registered in the name server.
-
run
()¶ Begin execution of the name server process and start the main loop.
-
shutdown
()¶ Shutdown the name server. All agents will be shutdown as well.
-
shutdown_all
()¶ Shutdown all agents registered in the name server.
-
start
()¶ Start the system process.
Raises: RuntimeError
– If an error occurred when initializing the daemon.
-
-
osbrain.nameserver.
random_nameserver_process
(host='127.0.0.1', port_start=10000, port_stop=20000, timeout=3.0, base=<class 'osbrain.nameserver.NameServer'>)¶ Start a random NameServerProcess.
Parameters: - host (str, default is '127.0.0.1') – Host address where the name server will bind to.
- port_start (int) – Lowest port number allowed.
- port_stop (int) – Highest port number allowed.
Returns: The name server process started.
Return type:
-
osbrain.nameserver.
run_nameserver
(addr=None, base=<class 'osbrain.nameserver.NameServer'>)¶ Ease the name server creation process.
This function will create a new nameserver, start the process and then run its main loop through a proxy.
Parameters: addr (SocketAddress, default is None) – Name server address. Returns: A proxy to the name server. Return type: proxy