schrodinger.seam.viz.watcher module

This module provides a webserver that serves a webapp that displays the pipeline graph of a seam pipeline. The webapp is served at http://localhost:8000.

Usage:

$SCHRODINGER/run python3 -m schrodinger.seam.viz.server start $SCHRODINGER/run python3 -m schrodinger.seam.viz.server start path/to/local/seam

exception schrodinger.seam.viz.watcher.InvalidResponseError

Bases: Exception

class schrodinger.seam.viz.watcher.WatcherDirReader(local_seamdir: Optional[pathlib.Path] = None, seamwatcher_dir: pathlib.Path = PosixPath('/home/buildbot/.seamwatcher'))

Bases: object

Read the state of pipeline(s) from the seamwatcher directory to provide and transform information required by the webserver.

__init__(local_seamdir: Optional[pathlib.Path] = None, seamwatcher_dir: pathlib.Path = PosixPath('/home/buildbot/.seamwatcher'))
Parameters
  • local_seamdir – the path to the local seam directory. If set, then all methods will read from the local seam directory instead of the seamwatcher directory.

  • seamwatcher_dir – the path to the seamwatcher directory

getDot(pipeline_id: str, view_type: str, expanded_transforms: List, color_by: str) str

Given a pipeline id and view options, return the dot representation of the pipeline as a string.

getEventsFileFromPipelineID(pipeline_id: str) pathlib.Path

Given a pipeline id, return the path to the .events file for that pipeline.

getDotFromEventsFile(events_file, viewType, expandedTransforms: list, colorBy: str)

Given a path to a .events file, return the dot representation of the pipeline as a string.

getLogs(pipeline_id: str, sanitize=False)
class schrodinger.seam.viz.watcher.ResponseType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.Enum

TEXT = 'text/plain'
JSON = 'application/json'
HTML = 'text/html'
ZIP = 'application/zip'
class schrodinger.seam.viz.watcher.EndpointInfo(path: str, request_schema: Dict[str, Any], response_type: schrodinger.seam.viz.watcher.ResponseType)

Bases: object

path: str
request_schema: Dict[str, Any]
response_type: schrodinger.seam.viz.watcher.ResponseType
__init__(path: str, request_schema: Dict[str, Any], response_type: schrodinger.seam.viz.watcher.ResponseType) None
exception schrodinger.seam.viz.watcher.InvalidRequestError

Bases: Exception

schrodinger.seam.viz.watcher.endpoint(endpoint_name: str, request_schema: dict = None, response_type: schrodinger.seam.viz.watcher.ResponseType = ResponseType.JSON, accepts_sessiontoken: bool = False)

Decorator to add an endpoint to the server.

Parameters
  • endpoint_name – the name of the endpoint

  • request_schema – the schema for the request parameters

  • response_type – the type of the response

  • accepts_sessiontoken – whether the endpoint accepts a session token

Returns

the decorated function

class schrodinger.seam.viz.watcher.WatcherWebServer(local_seamdir: Optional[str] = None, seamwatcher_dir: pathlib.Path = PosixPath('/home/buildbot/.seamwatcher'))

Bases: schrodinger.seam.viz.watcher._BaseServer

SERVER_ROOT = '/'
__init__(local_seamdir: Optional[str] = None, seamwatcher_dir: pathlib.Path = PosixPath('/home/buildbot/.seamwatcher'))
sessiontokenHasAccess(sessiontoken: Optional[str], pipeline_id: str) bool

Check if a session token has access to a pipeline. By default, all session tokens have access to all pipelines. Subclasses can override this method to implement access control.

Parameters
  • sessiontoken – the session token to check

  • pipeline_id – the pipeline id to check

dot_endpoint(params, sessiontoken=None)
logs_endpoint(params, sessiontoken=None)
pipelines_endpoint(params, sessiontoken=None)
pipeline_info_endpoint(params, sessiontoken=None)
index_endpoint(params)
favicon_endpoints(params)
static start_simple_http_server(local_seamdir: Optional[str] = None, seamwatcher_dir: pathlib.Path = PosixPath('/home/buildbot/.seamwatcher'))

Start a simple HTTP server that serves the watcher webapp. Only intended for local use, not for production servers that might require more security.

Parameters

local_seamdir – the path to a local seam directory. If set, the server will make the local seamdir available to the webapp.

schrodinger.seam.viz.watcher.get_parser() argparse.ArgumentParser
schrodinger.seam.viz.watcher.main(args: Optional[List[str]] = None)