samlab.dashboard module

Warning

module ‘samlab.dashboard’ undocumented

class samlab.dashboard.Server(host=None, port=None, config=True, coverage=False, quiet=True)[source]

Bases: object

Create an instance of Dashboard for unit tests and tutorials. For your real work you will likely want to setup and administer a dedicated instance of the Samlab dashboard server; this class makes it easy to start a temporary instance for use in tutorials and our unit tests:

>>> server = samlab.dashboard.Server()
... Use the server here ...
>>> server.stop()
>>> database.stop()

Alternatively, you can use the server object as a context manager for automatic cleanup:

>>> with samlab.dashboard.Server() as server:
...         ... Use the server here ...
>>> # Server is automatically cleaned-up when the `with` block is exited.
Parameters
  • host (string, optional) – Host interface for binding. Defaults to localhost to prevent outside connections.

  • port (int, optional) – Port for binding. Defaults to a randomly-chosen open port.

  • quiet (bool, optional) – If True (the default), suppresses output from the samlab server process.

browser(timeout=None)[source]

Open a web browser pointed to the running server.

ready(timeout=None)[source]

Wait until the server has started and is ready to receive requests.

stop()[source]

Stop the running dashboard server. :raises RuntimeError, if called more than once, or called on an instance used as a context manager.:

property uri

Address of the running server that can be used with web clients.

class samlab.dashboard.Writer(root)[source]

Bases: object

Warning

class ‘samlab.dashboard.Writer’ undocumented

add_document(*, key, document)[source]

Warning

method ‘samlab.dashboard.Writer.add_document’ undocumented

add_scalar(*, key, value, index=None, timestamp=None)[source]

Warning

method ‘samlab.dashboard.Writer.add_scalar’ undocumented