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({'__module__': 'PyFoam.Infrastructure.FoamMetaServer', '__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 ', '__init__': <function FoamMetaServer.__init__>, 'list': <function FoamMetaServer.list>, 'collect': <function FoamMetaServer.collect>, 'scan': <function FoamMetaServer.scan>, 'kill': <function FoamMetaServer.kill>, '_suicide': <function FoamMetaServer._suicide>, 'registerServer': <function FoamMetaServer.registerServer>, '_registerServer': <function FoamMetaServer._registerServer>, 'deregisterServer': <function FoamMetaServer.deregisterServer>, 'forwardCommand': <function FoamMetaServer.forwardCommand>, '__dict__': <attribute '__dict__' of 'FoamMetaServer' objects>, '__weakref__': <attribute '__weakref__' of 'FoamMetaServer' objects>})
__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]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

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]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

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', '__doc__': 'Contains the information about a server', '__init__': <function ServerInfo.__init__>, 'checkValid': <function ServerInfo.checkValid>, 'queryData': <function ServerInfo.queryData>, '__getitem__': <function ServerInfo.__getitem__>, '__setitem__': <function ServerInfo.__setitem__>, '__dict__': <attribute '__dict__' of 'ServerInfo' objects>, '__weakref__': <attribute '__weakref__' of 'ServerInfo' objects>})
__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