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__ = dict_proxy({'__module__': 'PyFoam.Infrastructure.FoamMetaServer', 'registerServer': <function registerServer>, '_suicide': <function _suicide>, 'scan': <function scan>, 'list': <function list>, '_registerServer': <function _registerServer>, 'forwardCommand': <function forwardCommand>, 'collect': <function collect>, 'deregisterServer': <function deregisterServer>, 'kill': <function kill>, '__dict__': <attribute '__dict__' of 'FoamMetaServer' objects>, '__weakref__': <attribute '__weakref__' of 'FoamMetaServer' objects>, '__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 __init__>})
__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__ = dict_proxy({'__dict__': <attribute '__dict__' of 'ServerInfo' objects>, '__module__': 'PyFoam.Infrastructure.FoamMetaServer', 'checkValid': <function checkValid>, '__getitem__': <function __getitem__>, '__setitem__': <function __setitem__>, '__weakref__': <attribute '__weakref__' of 'ServerInfo' objects>, 'queryData': <function queryData>, '__init__': <function __init__>, '__doc__': 'Contains the information about a server'})
__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