osbrain.proxy — osBrain proxy logic¶
Implementation of proxy-related features.
-
class
osbrain.proxy.NSProxy(nsaddr=None, timeout=3)¶ Bases:
Pyro4.core.ProxyA proxy to access a name server.
Parameters: - nsaddr : SocketAddress, str
Name server address.
- timeout : float
Timeout, in seconds, to wait until the name server is discovered.
Methods
addr([agent_alias, address_alias])Return the name server address or the address of an agent’s socket. proxy(name[, timeout])Get a proxy to access an agent registered in the name server. release()Release the connection to the Pyro daemon. shutdown([timeout])Shutdown the name server. shutdown_agents([timeout])Shutdown all agents registered in the name server. -
addr(agent_alias=None, address_alias=None)¶ Return the name server address or the address of an agent’s socket.
Parameters: - agent_alias : str, default is None
The alias of the agent to retrieve its socket address.
- address_alias : str, default is None
The alias of the socket address to retrieve from the agent.
Returns: - SocketAddress or AgentAddress
The name server or agent’s socket address.
-
proxy(name, timeout=3.0)¶ Get a proxy to access an agent registered in the name server.
Parameters: - name : str
Proxy name, as registered in the name server.
- timeout : float
Timeout, in seconds, to wait until the agent is discovered.
Returns: - Proxy
A proxy to access an agent registered in the name server.
-
release()¶ Release the connection to the Pyro daemon.
-
shutdown(timeout=3.0)¶ Shutdown the name server. All agents will be shutdown as well.
Parameters: - timeout : float, default is 3.
Timeout, in seconds, to wait for the agents to shutdown.
-
shutdown_agents(timeout=3.0)¶ Shutdown all agents registered in the name server.
Parameters: - timeout : float, default is 3.
Timeout, in seconds, to wait for the agents to shutdown.
-
class
osbrain.proxy.Proxy(name, nsaddr=None, timeout=3.0, safe=None)¶ Bases:
Pyro4.core.ProxyA proxy to access remote agents.
Parameters: - name : str
Proxy name, as registered in the name server.
- nsaddr : SocketAddress, str
Name server address.
- timeout : float
Timeout, in seconds, to wait until the agent is discovered.
- safe : bool, default is None
Use safe calls by default. When not set, environment’s OSBRAIN_DEFAULT_SAFE is used.
Attributes: - safe
- unsafe
Methods
nsaddr()Returns: release()Release the connection to the Pyro daemon. -
nsaddr()¶ Returns: - SocketAddress
The socket address of the name server.
-
release()¶ Release the connection to the Pyro daemon.
-
safe¶
-
unsafe¶
-
osbrain.proxy.locate_ns(nsaddr, timeout=3.0)¶ Locate a name server to ensure it actually exists.
Parameters: - nsaddr : SocketAddress
The address where the name server should be up and running.
- timeout : float
Timeout in seconds before aborting location.
Returns: - nsaddr
The address where the name server was located.
Raises: - NamingError
If the name server could not be located.