Module solver_interfaces

class pysph.solver.solver_interfaces.CommandlineInterface[source]

Bases: object

command-line interface to the solver controller

class pysph.solver.solver_interfaces.CrossDomainXMLRPCRequestHandler(request, client_address, server)[source]

Bases: SimpleXMLRPCServer.SimpleXMLRPCRequestHandler, SimpleHTTPServer.SimpleHTTPRequestHandler

SimpleXMLRPCRequestHandler subclass which attempts to do CORS

CORS is Cross-Origin-Resource-Sharing (http://www.w3.org/TR/cors/) which enables xml-rpc calls from a different domain than the xml-rpc server (such requests are otherwise denied)

do_GET()[source]

Handle http requests to serve html/image files only

do_OPTIONS()[source]

Implement the CORS pre-flighted access for resources

end_headers()[source]

End response header with adding Access-Control-Allow-Origin

This is done to enable CORS request from all clients

class pysph.solver.solver_interfaces.MultiprocessingClient(address=None, authkey=None, serializer='pickle', start=True)[source]

Bases: multiprocessing.managers.BaseManager

A client for the multiprocessing interface

Override the run() method to do appropriate actions on the proxy instance of the controller object or add an interface using the add_interface methods similar to the Controller.add_interface method

add_interface(callable)[source]

This makes it act as substitute for the actual command_manager

start(connect=True)[source]

Spawn a server process for this manager object

class pysph.solver.solver_interfaces.MultiprocessingInterface(address=None, authkey=None, try_next_port=False)[source]

Bases: multiprocessing.managers.BaseManager

A multiprocessing interface to the solver controller

This object exports a controller instance proxy over the multiprocessing interface. Control actions can be performed by connecting to the interface and calling methods on the controller proxy instance

start(controller)[source]

Spawn a server process for this manager object

class pysph.solver.solver_interfaces.XMLRPCInterface(addr, requestHandler=<class pysph.solver.solver_interfaces.CrossDomainXMLRPCRequestHandler>, logRequests=True, allow_none=True, encoding=None, bind_and_activate=True)[source]

Bases: SimpleXMLRPCServer.SimpleXMLRPCServer

An XML-RPC interface to the solver controller

Currently cannot work with objects which cannot be marshalled (which is basically most custom classes, most importantly ParticleArray and numpy arrays)