Config¶
Configuration management for slurm-viewer
Classes:
| Name | Description |
|---|---|
Cluster |
Cluster definition. |
Config |
Application config |
Tabs |
Available tabs |
UiSettings |
UI settings for the various widgets |
Functions:
| Name | Description |
|---|---|
create_default_config |
Create a default config. |
get_config_filename |
Get the path for the config file using these steps: |
Cluster
¶
Bases: BaseModel
Cluster definition.
Attributes:
| Name | Type | Description |
|---|---|---|
ignore_partitions |
list[str]
|
Partitions to ignore from partitions list. |
name |
str
|
Name of the cluster for display. |
node_name_ignore_prefix |
list[str]
|
Prefix to strip from node names (shorten names if a prefix is use, i.e. 'res-hpc-'. |
partitions |
list[str]
|
Partitions to use when retrieving data. |
servers |
list[str]
|
List of server names to use, all pointing to the same server (multiple logon nodes for the same cluster). |
tabs |
list[Tabs]
|
Which tabs to display. |
ignore_partitions
¶
Partitions to ignore from partitions list.
node_name_ignore_prefix
¶
Prefix to strip from node names (shorten names if a prefix is use, i.e. 'res-hpc-'.
partitions
¶
Partitions to use when retrieving data.
servers
¶
servers: list[str] = Field(
default=[],
validation_alias=AliasChoices("server", "servers"),
description="List of servers to use.",
)
List of server names to use, all pointing to the same server (multiple logon nodes for the same cluster).
Config
¶
Bases: BaseModel
Application config
Methods:
| Name | Description |
|---|---|
get_cluster |
Get cluster definition by name. |
init |
Create a default config. |
load |
Load config from file. |
Attributes:
| Name | Type | Description |
|---|---|---|
clusters |
list[Cluster]
|
List of clusters to display. |
config_file |
Path
|
Get the path to the config file. |
ui |
UiSettings
|
The UI settings. |
get_cluster
¶
init
¶
init() -> Config
Create a default config.
Source code in src/slurm_viewer/data/config.py
load
¶
Load config from file.
Source code in src/slurm_viewer/data/config.py
Tabs
¶
UiSettings
¶
Bases: BaseModel
UI settings for the various widgets
Attributes:
| Name | Type | Description |
|---|---|---|
auto_refresh |
bool
|
Auto-refresh data |
node_columns |
list[str]
|
Columns for the noded widget. |
priority_columns |
list[str]
|
Columns for the priority widget. |
queue_columns |
list[str]
|
Columns for the queue widget. |
refresh_interval |
int
|
Refresh interval in seconds. |
user_only |
bool
|
Display only current user jobs or all jobs. |
create_default_config
¶
create_default_config() -> Config | None
Create a default config.
Source code in src/slurm_viewer/data/config.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
get_config_filename
¶
Get the path for the config file using these steps: - Use the 'SLURM_VIEW_CONFIG' environment variable - Use the path provided (if it exists) - Use the '~/.config/slurm-viewer/settings.toml' file (if it exists)
Source code in src/slurm_viewer/data/config.py
Example¶
# General settings
[ui]
node_columns = [
"node_name",
"state",
"gpu_tot",
"gpu_avail",
"gpu_type",
"gpu_mem",
"cpu_tot",
"cpu_avail",
"mem_tot",
"mem_avail",
"load_norm",
"reason",
"available_features"
]
queue_columns = [
"user",
"account",
"exec_host",
"reason",
"start_delay",
"run_time",
"time_limit",
"req_nodes",
"excluded_nodes",
"cpus",
"name",
"partition",
]
refresh_interval = 10
auto_refresh = "False"
user_only = "False"
[[clusters]]
name = "MySlurm"
partitions = ["gpu-short", "gpu-medium", "gpu-long"]
ignore_partitions = []
node_name_ignore_prefix = ["res-hpc-"]
servers = ["logon_node_1", "logon_node_2"]
tabs = ["nodes", "jobs", "gpu", "status"]