Session Management

SessionManager stores per-session working directories, config paths, mesh paths, and last-run metadata.

Current guarantees

  • Session creation returns an opaque UUID string.

  • Missing sessions raise KeyError with stable error text.

  • Closing a session can optionally remove the working directory.

Session management utilities for SU2 MCP server.

class su2_mcp.session_manager.LastRunMetadata(solver, config_used, exit_code, runtime_seconds, log_tail)[source]

Metadata captured after running a SU2 solver.

class su2_mcp.session_manager.SessionManager[source]

Manage SU2 sessions and their resources.

Create an empty session registry.

close_session(session_id, delete_workdir=False)[source]

Close a session and optionally remove its working directory.

create_session(base_name=None, initial_config=None, initial_mesh=None, mesh_file_name='mesh.su2')[source]

Create a new SU2 session with optional seed files.

get(session_id)[source]

Return the session record if it exists.

record_run(session_id, metadata)[source]

Store the last run metadata for the session.

require(session_id)[source]

Return the session record or raise if missing.

to_info(session_id)[source]

Return a JSON-friendly description of the session.

update_mesh(session_id, mesh_base64, mesh_file_name='mesh.su2')[source]

Persist a mesh to the session directory and update bookkeeping.

class su2_mcp.session_manager.SessionRecord(session_id, workdir, config_path, mesh_path=None, last_run_metadata=None, lock=<factory>)[source]

Session state stored by SessionManager.