dips.ApplicationManager module#

class dips.ApplicationManager.ApplicationManager#

Bases: object

defaultTimeout = 120#
maximumPort = 65535#
minimumPort = 49152#
startApplication(pathToExecutable: str, port: int, isServerRunning: callable, logger: Logger, timeout: float = 120, headless: bool = False, fileToOpen: str = None)#

Starts the application specified by pathToExecutable and starts the python server on the given port. Returns when the server is ready to accept requests. Throws TimeoutError exception if the server is not ready within that time.

Parameters:
  • pathToExecutable – the full path to the executable of the application you want to start.

  • port – the port number you want the python server to bind to.

  • isServerRunning – a callable that returns True if the server is ready to accept requests.

  • logger – a logger object. It will be disabled while trying to connect to the server.

  • timeout – time in seconds before we stop trying to start the application

Raises:

ValueError – Port range must be between 49152 and 65535, otherwise ValueError is raised TimeoutError: if timeout is provided, raises TimeoutError if not able to connect to the server within that time.