PyFoam.Infrastructure.FoamMetaServer module

A XMLRPC-Server that knows all PyFoam-Runs in its subnet

class PyFoam.Infrastructure.FoamMetaServer.FoamMetaServer(port=None)[source]

Bases: object

The Metaserver.

Collects all the known FoamServers. Then waits for the servers to register themselves. Checks at regular intervalls whether the processes are still alive

__dict__ = mappingproxy({'deregisterServer': <function FoamMetaServer.deregisterServer>, '__dict__': <attribute '__dict__' of 'FoamMetaServer' objects>, '_suicide': <function FoamMetaServer._suicide>, '__weakref__': <attribute '__weakref__' of 'FoamMetaServer' objects>, 'registerServer': <function FoamMetaServer.registerServer>, 'collect': <function FoamMetaServer.collect>, '__doc__': 'The Metaserver.\n\n Collects all the known FoamServers. Then waits for the servers to\n register themselves. Checks at regular intervalls whether the processes are still alive\n ', '__module__': 'PyFoam.Infrastructure.FoamMetaServer', 'scan': <function FoamMetaServer.scan>, '__init__': <function FoamMetaServer.__init__>, 'kill': <function FoamMetaServer.kill>, 'list': <function FoamMetaServer.list>, 'forwardCommand': <function FoamMetaServer.forwardCommand>, '_registerServer': <function FoamMetaServer._registerServer>})
__init__(port=None)[source]
Parameters:port – The port on which the server should listen
__module__ = 'PyFoam.Infrastructure.FoamMetaServer'
__weakref__

list of weak references to the object (if defined)

_registerServer(ip, pid, port, sync=True, external=False)[source]

Registers a new server :param ip: IP of the server :param pid: Die PID at the server :param port: the port at which the server is listening :param external: was called via XMLRPC :param sync: (optional) if to sync with the webserver or not

_suicide()[source]

The server kills itself

collect()[source]

Starts a thread that collects the data of the servers from the net

deregisterServer(ip, pid, port, sync=True)[source]

Deregisters a server :param ip: IP of the server :param pid: Die PID at the server :param port: the port at which the server is listening :param sync: (optional) if to sync with the webserver or not

forwardCommand(ip, port, cmd)[source]

Forwards a RPC to another machine :param ip: IP of the server :param port: the port at which the server is listening :param cmd: the command that should be executed there :return: the result of the command

kill()[source]

Exits the server

list()[source]

Returns a list of the found Foam-Runs

registerServer(ip, pid, port, sync=True, external=False)[source]

Registers a new server via XMLRPC :param ip: IP of the server :param pid: Die PID at the server :param port: the port at which the server is listening :param sync: (optional) if to sync with the webserver or not

scan(additional)[source]

Starts a thread that collects the data of the servers from the net :param additional: a string with a list of additional subnets that should be scanned

class PyFoam.Infrastructure.FoamMetaServer.MetaChecker(parent)[source]

Bases: threading.Thread

Checks regularily whether the registered Servers are still alive

__init__(parent)[source]
Parameters:parent – the FoamMetaServer that gets the information
__module__ = 'PyFoam.Infrastructure.FoamMetaServer'
run()[source]
class PyFoam.Infrastructure.FoamMetaServer.MetaCollector(parent, additional=None)[source]

Bases: threading.Thread

Scans the net in a separate thread

__init__(parent, additional=None)[source]
Parameters:
  • parent – the FoamMetaServer that gets the information
  • additional – A string with alist of additional subnets that should be scanned
__module__ = 'PyFoam.Infrastructure.FoamMetaServer'
run()[source]
class PyFoam.Infrastructure.FoamMetaServer.ServerInfo(ip, pid, port, ssl=False)[source]

Bases: object

Contains the information about a server

__dict__ = mappingproxy({'__module__': 'PyFoam.Infrastructure.FoamMetaServer', '__weakref__': <attribute '__weakref__' of 'ServerInfo' objects>, '__doc__': 'Contains the information about a server', '__dict__': <attribute '__dict__' of 'ServerInfo' objects>, 'checkValid': <function ServerInfo.checkValid>, '__getitem__': <function ServerInfo.__getitem__>, 'queryData': <function ServerInfo.queryData>, '__setitem__': <function ServerInfo.__setitem__>, '__init__': <function ServerInfo.__init__>})
__getitem__(key)[source]
__init__(ip, pid, port, ssl=False)[source]
Parameters:
  • ip – IP of the server
  • pid – Die PID at the server
  • port – the port at which the server is listening
__module__ = 'PyFoam.Infrastructure.FoamMetaServer'
__setitem__(key, value)[source]
__weakref__

list of weak references to the object (if defined)

checkValid()[source]

Check with server whether this data item is still valid

queryData()[source]

Ask the server for additional data