Server Manager

class streamlit_pyvista.server_managers.server_manager.ServerManagerBase(host='0.0.0.0', port=8080)[source]

Bases: ABC

This class is the base for any ServerManager implementation

__init__(host='0.0.0.0', port=8080)[source]
abstract init_connection()[source]

This function receive request of clients that require a trame server to display meshes. It’s in this class that we need by any means start a trame server and get its endpoints :returns: A response containing a json with all required endpoint for a MeshViewerComponent to work properly :rtype: Response

run_server()[source]

Start the flask server and the scheduler

abstract static get_launch_path()[source]

This function must be used to get the path to the file of the manager that will be launched :returns: the path to the file that launch the server :rtype: str

get_oldest_server(server_type)[source]

Retrieve the oldest server created that match the type specified. If None is found the oldest server is killed to free a spot for a server of the required type

Parameters:
  • server_type (str) – The type of the server, in other word, the sha256 of the content of the file containing

  • definition (the server class)

Returns:

The oldest server matching the specified type or None if it doesn’t exist

Return type:

Optional[ServerItem]

streamlit_pyvista.server_managers.server_manager.run_trame_viewer(server_port, file_path)[source]

Launch a Trame server using python subprocess

class streamlit_pyvista.server_managers.server_manager.ServerManager(host='0.0.0.0', port=8080)[source]

Bases: ServerManagerBase

Implementation of a ServerManagerBase to run trame viewer locally

__init__(host='0.0.0.0', port=8080)[source]
init_connection()[source]

This function receive request of clients that require a trame server to display meshes. It’s in this class that we need by any means start a trame server and get its endpoints :returns: A response containing a json with all required endpoint for a MeshViewerComponent to work properly :rtype: Response

static get_launch_path()[source]

This function must be used to get the path to the file of the manager that will be launched :returns: the path to the file that launch the server :rtype: str