srunx.web package#
Subpackages#
Submodules#
srunx.web.app module#
srunx.web.config module#
- class srunx.web.config.WebConfig(**data)[source]#
Bases:
BaseModelWeb server configuration.
- host: str#
- port: int#
- cors_origins: list[str]#
- ssh_profile: str | None#
- ssh_hostname: str | None#
- ssh_username: str | None#
- ssh_key_filename: str | None#
- ssh_port: int#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
srunx.web.deps module#
FastAPI dependency injection providers.
srunx.web.serializers module#
Serialize data for frontend-compatible responses.
In the SSH adapter architecture, most data is already dicts from the adapter’s parsing. These helpers normalize edge cases.
srunx.web.ssh_adapter module#
SSH-based SLURM adapter for the Web UI.
Wraps SSHSlurmClient to provide all operations needed by the REST API, including list_jobs, cancel_job, and get_resources which SSHSlurmClient does not natively support.
- class srunx.web.ssh_adapter.SlurmSSHAdapter(*, profile_name=None, hostname=None, username=None, key_filename=None, port=22)[source]#
Bases:
objectAdapter providing a unified API for the Web UI over SSH.
- submit_job(script_content, job_name=None, dependency=None)[source]#
Submit a job via sbatch. Returns job info dict.
- Return type:
dict[str,Any]
srunx.web.state module#
In-memory workflow run registry.
- class srunx.web.state.WorkflowRun(**data)[source]#
Bases:
BaseModelTracks a single workflow execution.
- id: str#
- workflow_name: str#
- started_at: str#
- completed_at: str | None#
- status: RunStatus#
- job_statuses: dict[str, str]#
- job_ids: dict[str, str]#
- error: str | None#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class srunx.web.state.RunRegistry[source]#
Bases:
objectThread-safe in-memory registry for workflow runs.
- get(run_id)[source]#
- Return type:
WorkflowRun|None
- list_runs(workflow_name=None)[source]#
- Return type:
list[WorkflowRun]
- update_job_status(run_id, job_name, status)[source]#
Update a single job’s status within a run.
- Return type:
None
srunx.web.sync_utils module#
Shared rsync sync utilities for web routers.
- srunx.web.sync_utils.get_current_profile()[source]#
Get the current SSH profile from web config or ConfigManager.
Checks
SRUNX_SSH_PROFILE(viaget_web_config()) first, then falls back toConfigManager.get_current_profile_name().Returns
Noneif no profile is configured.- Return type:
ServerProfile|None
- srunx.web.sync_utils.build_rsync_client(profile)[source]#
Create RsyncClient from SSH profile, handling ssh_host vs hostname.
When ssh_host is set the client delegates all connection parameters (user, key, proxy, port) to
~/.ssh/config.- Return type:
- srunx.web.sync_utils.sync_mount_by_name(profile, mount_name)[source]#
Sync a named mount’s local directory to remote via rsync.
- Raises:
ValueError – If mount_name does not exist in the profile.
RuntimeError – If the rsync process exits with a non-zero code.
- Return type:
None
- srunx.web.sync_utils.resolve_mounts_for_workflow(profile, jobs_data, default_project=None)[source]#
Identify mount names to sync for a workflow’s jobs.
Matches each job’s
work_diragainst mount remote paths using longest-prefix matching. Also includes default_project if it corresponds to a valid mount.- Return type:
list[str]- Returns:
Deduplicated list of mount names.