slurmrestd(8)
πΈ slurmrestd β the Slurm REST Daemon, bestie edition πΈ
okay so welcome to slurmrestd(8), aka the Slurm REST Daemon page, aka the moment your fave cluster gets a REST API glow-up. it's section 8 of the manual, it's iconic, and we're gonna get through it together. no cap. π
β¨ NAME β¨
slurmrestd β the interface to Slurm via REST API. that's it, that's the whole name section. short, sweet, main character energy. π
π¦ SYNOPSIS π¦
slurmrestd [OPTIONS...] <[host]:port|unix:/path/to/socket>...
likeβ¦ copy that exactly, don't freestyle it. the angle brackets are doing WORK here, iykyk. π
π« DESCRIPTION π«
slurmrestd is the REST API interface for Slurm. literally that's its whole thing. and the way it can run? two modes. TWO. she's versatile, she's flexible, she contains multitudes. π§
π Inetd Mode π
in this mode, slurmrestd reads from and writes to STDIO. and here's the cute part β if STDIN happens to be a socket file descriptor, slurmrestd will detect that on its own and then use the relevant functionality. she just knows. π
this mode is designed to vibe with:
- piped input
inetdxinetdsystemdsocket activation
so if your setup is one of those, this mode is for you, bestie. periodt. π«Ά
π₯ Listen Mode π₯
in this mode, slurmrestd opens a listening socket</> on every host:port pair you asked for β or on a UNIX socket. you request it, she listens. simple as that. slay. β¨
more parts coming, don't go anywhere β we're just getting started π
β¨ OPTIONS β¨
hiii bestie, welcome to the options menu πΈ every single flag and every single plugin lives down here, so grab a snack and let's go through them one by one π
[https://][host]:portβ the hostname and port to listen against π host can be an IPv4/IPv6 IP or a resolvable hostname. Heads up: hostnames get looked up only at startup, they do not change for the life of the process β no cap. host is optional; if you don't give one,slurmrestdwill listen on all network interfaces π. Thehttps://part is optional too; if you don't provide it,slurmrestdwill automatically use the TLS plugin to encrypt traffic when possible β¨. But if you do specifyhttps://, thenslurmrestdwill require the configured TLS plugin to encrypt traffic, periodt π.unix:///path/to/socketβ listen on a local UNIX socket π. You must have permission to create the socket in the filesystem, so like, make sure you actually can π.-a <plugin>[,plugin]...β comma-delimited list of authentication plugins to load π. By default, all available authentication plugins will be loaded. The options are:listβ display a list of the possible plugins to load β¨.rest_auth/localβ allows authentication via UNIX sockets whenauth/mungeis active.- NOTE:
slurmrestdand client processes must run under the same UID or the client requests will be rejected π no exceptions.
- NOTE:
rest_auth/jwtβ allows authentication via TCP and UNIX sockets whenAuthAltTypes=auth/jwtis active. The user must specify the following HTTP cookies with every request:X-SLURM-USER-NAME:<user name>X-SLURM-USER-TOKEN:<JSON Web Token>- NOTE: Tokens are usually generated via calling
scontrol tokenποΈ.
-d <plugin>[,plugin]...β comma-delimited list ofdata_parserplugins, which will determine the output format π . May include optional flags denoted by the+symbol. By default, all availabledata_parserplugins will be loaded without any optional flags β¨. See also-sfor the OpenAPI plugins controlling the available content. Defaults: all builtin supporteddata_parserplugins.list[+flags]β display a list of the possible plugins to load.latestβ automatically replaced with the latest plugin version. See the relevant plugin for its description and potential flags π.[data_parser/]v0.0.40[+fast]β load the[data_parser/]v0.0.40plugin for formatting of data. Only compatible withopenapi/slurmctldandopenapi/slurmdbdcontent plugins.+fastβ disable builtin warnings and other logic that strictly validates incoming requests π. Should only ever be used in a production environment with very well tested clients, and potentially malformatted requests will be accepted as given, and no warnings will be generated about ignored or incorrect fields or values. So like, be careful fr fr.
[data_parser/]v0.0.41[+fast][+prefer_refs]β load the[data_parser/]v0.0.41plugin for formatting of data. Only compatible withopenapi/slurmctldandopenapi/slurmdbdcontent plugins.+fastβ disable builtin warnings and other logic that strictly validates incoming requests π. Should only ever be used in a production environment with very well tested clients, and potentially malformatted requests will be accepted as given, and no warnings will be generated about ignored or incorrect fields or values.+prefer_refsβ prefer inline expansion of referenced schemas (via$ref) in generated OpenAPI specifications if the schema is only referenced once π¦.
[data_parser/]v0.0.42[+fast][+minimize_refs][+inline_enums]β load the[data_parser/]v0.0.42plugin for formatting of data. Only compatible withopenapi/slurmctldandopenapi/slurmdbdcontent plugins.+fastβ disable builtin warnings and other logic that strictly validates incoming requests π. Should only ever be used in a production environment with very well tested clients, and potentially malformatted requests will be accepted as given, and no warnings will be generated about ignored or incorrect fields or values.+minimize_refsβ avoid inline expansion of referenced schemas (via$ref) in generated OpenAPI specifications if the schema is only referenced once β¨.+inline_enumsβ avoid inline expansion of referenced schemas (via$ref) in generated OpenAPI specifications for enum arrays π.
[data_parser/]v0.0.43[+fast][+minimize_refs]β load the[data_parser/]v0.0.43plugin for formatting of data. Only compatible withopenapi/slurmctldandopenapi/slurmdbdcontent plugins.+fastβ disable builtin warnings and other logic that strictly validates incoming requests π. Should only ever be used in a production environment with very well tested clients, and potentially malformatted requests will be accepted as given, and no warnings will be generated about ignored or incorrect fields or values.+minimize_refsβ avoid inline expansion of referenced schemas (via$ref) in generated OpenAPI specifications if the schema is only referenced once β¨.
[data_parser/]v0.0.44[+fast][+minimize_refs]β load the[data_parser/]v0.0.44plugin for formatting of data. Only compatible withopenapi/slurmctld,openapi/slurmdbd, andopenapi/utilcontent plugins πΈ.+fastβ disable builtin warnings and other logic that strictly validates incoming requests π. Should only ever be used in a production environment with very well tested clients, and potentially malformatted requests will be accepted as given, and no warnings will be generated about ignored or incorrect fields or values.+minimize_refsβ avoid inline expansion of referenced schemas (via$ref) in generated OpenAPI specifications if the schema is only referenced once β¨.
-f <file>β read Slurm configuration from the specified file π. See NOTES below, iykyk.--generate-openapi-specβ dump a JSON formatted OpenAPI specification tostdoutand exit immediately β‘. Loads only the minimal plugins required. All"content"fields will only be in JSON format even if theserializer/yamlplugin is present and loadable π. Loading ofslurm.conf(5)can be disabled by passing additional arguments-f /dev/nullor settingSLURM_CONF=/dev/nullin the environment π§.-g <group id>β change group id (and drop supplemental groups) before processing client requests π. This should be a unique group with no write access or special permissions. Do not set this to the group belonging toSlurmUserorrootor the daemon won't start with the default settings π.-h,--helpβ help; print a brief summary of command options π«Ά.--max-connections <count>β set the maximum number of connections to process at any one time. This is independent of the number of connections that can connect toslurmrestdat any one time. The kernel allows any number of connections to be pending for processing at any one time when SYN cookies are active π.- β οΈ Caution: Each connection could cause one RPC to the controller daemons, leading to potential overloading of the controller π₯. Each connection can also hold memory for the duration of the life of the connection. Having too many connections processing at once could use considerably more memory π. Process limits (
ulimit(3)) may require adjustment when this value is increased. - Default:
124
- β οΈ Caution: Each connection could cause one RPC to the controller daemons, leading to potential overloading of the controller π₯. Each connection can also hold memory for the duration of the life of the connection. Having too many connections processing at once could use considerably more memory π. Process limits (
-s <plugin>[,plugin]...β comma-delimited list of OpenAPI plugins to load, which will determine the available content π . By default, the OpenAPI plugins loaded will beslurmctld,slurmdbdwhenAccountingStorageType=accounting_storage/slurmdbdis configured inslurm.conf(5), orslurmctldfor any other configuration β¨. See also-dfor thedata_parserplugins controlling the output format. The choices are:listβ display a list of the possible plugins to load π.[openapi/]slurmctldβ providesslurm/endpoints for the loadeddata_parserplugins π.[openapi/]slurmdbdβ providesslurmdb/endpoints for the loadeddata_parserplugins πΈ. This plugin will fail ifaccounting_storage/slurmdbdis not used in the cluster π¬.[openapi/]utilβ providesutil/endpoints for the loadeddata_parserplugins π§. Util is short for utility. It provides utilities available directly throughslurmrestd.
-t <THREAD COUNT>β specify the number of threads to use to process client connections π§΅. Ignored in inetd mode, just so you know.-u <user id>β change user id before processing client requests π. This should be a unique group with no write access or special permissions. Do not set this user toSlurmUserorrootor the daemon won't start with the default settings π.-vβ verbose operation π£οΈ. Multiplev's can be specified, with eachvbeyond the first increasing verbosity, up to 6 times (i.e.-vvvvvv). Higher verbosity levels will have significant performance impact π. SeeSLURMRESTD_DEBUGfor a description of logging targets.-Vβ print version information and exit β.
β¨ TLS β¨
So like, slurmrestd supports TLS encryption via the TLS plugin interface π. If you want the full β¨deluxeβ¨ description of how TLS works in Slurm, go peek at <https://slurm.schedmd.com/tls.html>, bestie.
Here's the tea π«: slurmrestd supports TLS encryption for incoming HTTPS connections independently of how TLSType in slurm.conf(5) is configured. But β and this is key β the configuration of TLSParameters in slurm.conf(5) is always applied. Which means the Slurm RPC layer can stay totally unencrypted via TLS while slurmrestd still services HTTPS requests via TLS. Two things, two vibes, no conflict, slay π
.
slurmrestd also has automatic detection of incoming TLS connections π. If the TLS plugin is fully configured and successfully loads at startup, then all new incoming connections get fingerprinted for SSLv3 (per RFC#6101) and TLSv1.x (per RFC#8446) handshakes. The moment there's a matching fingerprint, that incoming connection gets encrypted via the configured TLS plugin for the duration of the connection β¨. Support for TLS is handled independently of whether the connection is a unix(2), socket(2) or pipe(2) (in INETD mode). Listening connections created with https:// will be required to be encrypted via the TLS plugin. Any incoming connections to these listeners without TLS encryption get closed immediately without sending an error response to the client. not me ghosting you fr π
TLS support in slurmrestd is dependent on the requirements of the TLS plugin. slurmrestd will attempt to load the first available TLS plugin (except tls/none) automatically at startup. The requirements for each plugin are listed below:
π tls/s2n
The following files must be present and readable by the invoking user (before -u <user id> is applied) at startup:
restd_cert_file.pemβ TLS x509 server public certificate. Must be signed by a CA trusted by clients. The certificate's CN (common name) must match the hostname.slurmrestdignores the host in client HTTP requests but most TLS clients will require they match.
Note: The certificate's file must be placed in theautoconf(1)installation directory variablesysconfdir, which can be overridden via settingTLSParameters=restd_cert_file=/path/to/restd_cert_file.peminslurm.conf(5).
restd_cert_key_file.pemβ Private key forrestd_cert_file.pem. This file must only be readable by theslurmrestduser π.
Note: The certificate's file must be placed in theautoconf(1)installation directory variablesysconfdir, which can be overridden via settingTLSParameters=restd_cert_key_file=/path/to/restd_cert_key.peminslurm.conf(5).
π ENVIRONMENT VARIABLES π
The following environment variables can be used to override settings compiled into slurmrestd π.
πΈ ABORT_ON_FATAL
When a fatal error is detected, use abort() instead of exit() to terminate the process. This allows backtraces to be captured without recompiling Slurm.
πΈ SLURM_CONF
The location of the Slurm configuration file.
πΈ SLURM_DEBUG_FLAGS
Specify debug flags for slurmrestd to use. See DebugFlags in the slurm.conf(5) man page for a full list of flags. The environment variable takes precedence over the setting in the slurm.conf.
πΈ SLURM_DEBUG
Set debug level explicitly. Valid values are 0-9, or the same string values as the debug options such as SlurmctldDebug in slurm.conf(5). Increased if -v passed as argument during invocation. Ignored if SLURMRESTD_DEBUG or SLURMRESTD_DEBUG_STDERR or SLURMRESTD_DEBUG_SYSLOG are set in environment. See SLURMRESTD_DEBUG for description of logging targets.
πΈ SLURMRESTD_JSON or SLURM_JSON
Control JSON serialization:
compactβ Output JSON as compact as possible.prettyβ Output JSON in pretty format to make it more readable.
πΈ SLURM_JWT
This variable must be set to use JWT token authentication π.
πΈ SLURMRESTD_AUTH_TYPES
Set allowed authentication types. See -a.
πΈ SLURMRESTD_DEBUG
Set debug level explicitly. Valid values are 0-9, or the same string values as the debug options such as SlurmctldDebug in slurm.conf(5). If a controlling TTY is detected, interactive mode will automatically activate to provide additional logging information to stderr. If a controlling TTY is not detected, then logs are sent to syslog. Increased if -v passed as argument during invocation. Ignored if SLURMRESTD_DEBUG_STDERR or SLURMRESTD_DEBUG_SYSLOG are set in environment.
πΈ SLURMRESTD_DEBUG_STDERR
Set debug level explicitly for logging to STDERR. Valid values are 0-9, or the same string values as the debug options such as SlurmctldDebug in slurm.conf(5). Increased if -v passed as argument during invocation.
πΈ SLURMRESTD_DEBUG_SYSLOG
Set debug level explicitly for logging to syslog. Valid values are 0-9, or the same string values as the debug options such as SlurmctldDebug in slurm.conf(5). Increased if -v passed as argument during invocation.
πΈ SLURMRESTD_DATA_PARSER_PLUGINS
Comma-delimited list of data_parser plugins to load. See -d.
πΈ SLURMRESTD_LISTEN
Comma-delimited list of host:port pairs or unix sockets to listen on.
πΈ SLURMRESTD_MAX_CONNECTIONS
Set the maximum number of connections to process at any one time. See --max-connections.
πΈ SLURMRESTD_OPENAPI_PLUGINS
Comma-delimited list of OpenAPI plugins to load. See -s.
πΈ SLURMRESTD_RESPONSE_STATUS_CODES
Comma-delimited list of OpenAPI method responses to generate in OpenAPI specification. Default: 200,default.
πΈ SLURMRESTD_SECURITY
Control slurmrestd security functionality using the following comma-delimited values:
become_userβ Allowsslurmrestdto be run as root in order to become the requesting user for all requests. When combined withrest_auth/local, when a user connects via a named UNIX socket,slurmrestdwillsetuid()/setgid()into that user/group and then complete all requests as the given user. This mode is only intended for inet mode as the user change is permanent for the life of the process. This mode is incompatible withrest_auth/jwtand it is suggested to startslurmrestdwith"-a rest_auth/local"arguments. β οΈdisable_unshare_filesβ Disables unsharing file descriptors with parent process.disable_unshare_sysvβ Disables unsharing the SYSV namespace.disable_user_checkβ Disables the check thatslurmrestdis not running as root orSlurmUser, or with the root orSlurmUser's primary group.
β οΈ Big warning energy: disabling this check will allowslurmrestdto run as root orSlurmUser, which will allow anyone who can communicate with this daemon to run anything as the root user on the cluster. like... bestie, be so serious rn π
πΈ SLURMRESTD_YAML or SLURM_YAML
Control YAML serialization:
compactβ Output YAML as compact as possible.no_tagβ Output YAML without datatype!!tags.prettyβ Output YAML in pretty format to make it more readable.
π SIGNALS π
SIGINTβslurmrestdwill shutdown cleanly π§.SIGPIPEβ This signal is explicitly ignored.SIGPROFβ Logs connection manager state when debug level is at leastinfo.
π NOTES π
SPANK and clifilter plugins are not supported in slurmrestd due to their lack of thread safety π. Active SPANK plugins and JobSubmitPlugins in slurmctld are independent of slurmrestd and can be used to enforce site policy on job submissions π.
β¨ EXAMPLES β¨
Bestie, this is the fun part β here's what it all looks like IRL. π
π Make an OpenAPI schema with literally zero config
$ slurmrestd -f /dev/null --generate-openapi-spec -s slurmdbd,slurmctld -d v0.0.42 > openapi.json
No cap, -f /dev/null means "we have no config and we're thriving" and it still spits the spec right out. π
π¦ Start slurmrestd on a UNIX socket in listen mode
$ export SLURMRESTD=/var/spool/slurm/restd/rest
$ slurmrestd -s slurmctld,slurmdbd -d v0.0.42 unix:$SLURMRESTD
Look at her go. UNIX socket, listen mode, both plugins loaded, API version locked in. β¨
π Ping slurmctld to vibe-check the connection
While slurmrestd is chilling in listen mode:
$ export $(scontrol token)
$ curl --unix-socket "${SLURMRESTD}" -H "X-SLURM-USER-TOKEN:${SLURM_JWT}" 'http://ignored_with_unix_sockets/slurm/v0.0.42/ping' | jq '.pings'
[
{
"hostname": "omicronpersei8",
"pinged": "UP",
"latency": 314,
"mode": "primary"
}
]
UP! π«Ά The hostname is literally omicronpersei8 and honestly? iconic.
β Check on slurmdbd with a diag request
Still in listen mode, same energy:
$ export $(scontrol token)
$ curl --unix-socket "${SLURMRESTD}" -H "X-SLURM-USER-TOKEN:${SLURM_JWT}" 'http://ignored_with_unix_sockets/slurmdb/v0.0.42/diag' | jq '.pings'
1722009793
π§ Query a node's status when slurmrestd is in INETD mode
Here we're just piping a raw HTTP request straight into the daemon:
$ echo -e "GET http://ignored/slurm/v0.0.42/node/host1 HTTP/1.1\r\n" | slurmrestd
HTTP/1.1 200 OK
Content-Length: 3174
Content-Type: application/json
{
"nodes": [
{
"architecture": "x86_64",
"burstbuffer_network_address": "",
"boards": 1,
"boot_time": {
"set": true,
"infinite": false,
"number": 1720820315
},
"cluster_name": "",
"cores": 16,
"specialized_cores": 0,
"cpu_binding": 0,
"cpu_load": 446,
"free_mem": {
"set": true,
"infinite": false,
"number": 39871
},
"cpus": 32,
"effective_cpus": 32,
"specialized_cpus": "",
"energy": {
"average_watts": 0,
"base_consumed_energy": 0,
"consumed_energy": 0,
"current_watts": {
"set": false,
"infinite": false,
"number": 0
},
"previous_consumed_energy": 0,
"last_collected": 0
},
"external_sensors": {},
"extra": "",
"power": {},
"features": [],
"active_features": [],
"gpu_spec": "",
"gres": "gpu:fake1:1(S:0),gpu:fake2:1(S:0)",
"gres_drained": "NA",
"gres_used": "gpu:fake1:0(IDX:NA),gpu:fake2:0(IDX:NA)",
"instance_id": "",
"instance_type": "",
"last_busy": {
"set": true,
"infinite": false,
"number": 1722009794
},
"mcs_label": "",
"specialized_memory": 0,
"name": "host1",
"next_state_after_reboot": [
"INVALID"
],
"address": "localhost",
"hostname": "omicronpersei8",
"state": [
"IDLE"
],
"operating_system": "Linux 6.5.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:10:09 UTC 2024",
"owner": "",
"partitions": [
"debug"
],
"port": 5015,
"real_memory": 127927,
"res_cores_per_gpu": 0,
"comment": "",
"reason": "",
"reason_changed_at": {
"set": true,
"infinite": false,
"number": 0
},
"reason_set_by_user": "",
"resume_after": {
"set": true,
"infinite": false,
"number": 0
},
"reservation": "",
"alloc_memory": 0,
"alloc_cpus": 0,
"alloc_idle_cpus": 32,
"tres_used": "",
"tres_weighted": 0.0,
"slurmd_start_time": {
"set": true,
"infinite": false,
"number": 1722009794
},
"sockets": 1,
"threads": 2,
"temporary_disk": 0,
"weight": 1,
"tres": "cpu=32,mem=127927M,billing=32,gresgpu=2",
"version": "24.11.0-0rc1"
}
],
"last_update": {
"set": true,
"infinite": false,
"number": 1722010273
},
"meta": {
<<< TRIMMED >>>
},
"errors": [],
"warnings": []
}
Look at all those fields. π The detail is giving "I read the whole struct definition for fun."
π₯ Submit a job (listen mode, obvi)
First, here's the payload:
$ jq . example_job.json
{
"job": {
"script": "#!/bin/bash\nsleep 30",
"name": "ExampleJob",
"account": "sub1",
"environment": [
"PATH=/usr/bin/:/bin/"
],
"current_working_directory": "/tmp/",
"tasks": 12,
"memory_per_cpu": 100,
"time_limit": 240
}
}
Then POST it:
$ curl -H "Content-Type: application/json" --data-binary @example_job.json --unix-socket "${SLURMRESTD}" 'http://ignored/slurm/v0.0.42/job/submit'
{
"job_id": 9,
"step_id": "batch",
"job_submit_user_msg": "",
"meta": {
<<< TRIMMED >>>
},
"errors": [],
"warnings": []
}
Clean. Zero errors, zero warnings, job's off living its best life. π
And then the same exact call again:
$ curl -H "Content-Type: application/json" --data-binary @example_job.json --unix-socket "${SLURMRESTD}" 'http://ignored/slurm/v0.0.42/job/submit'
{
"job_id": 7,
"step_id": "batch",
"job_submit_user_msg": "",
"meta": {
},
"errors": [],
"warnings": [
{
"description": "Expected OpenAPI type=array (Slurm type=list) but got OpenAPI type=object (Slurm type=dictionary): {
"source": "#jobenvironment"
}
]
}
Heads up bestie: this time there's awarningsentry. It's complaining about#jobenvironmentβ it expected an OpenAPItype=array(Slurmtype=list) but got an OpenAPItype=object(Slurmtype=dictionary). The daemon still gives you the response, it's just flagging the shape mismatch. π
π COPYING π
Legal era, but make it cute. π
Copyright (C) 2019-2022 SchedMD LLC.
This file is part of Slurm, a resource management program. For details, see <https://slurm.schedmd.com/>.
Slurm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Slurm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Read that ALL-CAPS part again, bestie.WITHOUT ANY WARRANTY, no implied warranty ofMERCHANTABILITYorFITNESS FOR A PARTICULAR PURPOSE. Fr fr, that's the real ones talking. π
π SEE ALSO π
Go read her sisters too, they're all icons:
That's a wrap on slurmrestd(8)! π This whole page ships as part of Slurm 26.05, under the title Slurm REST Daemon, and yeah β slurmrestd(8) is the section it lives in. Stan a REST daemon that tells you the truth about your cluster. Slay, bye! β¨π¦π
π¦ where this page comes from
- arch rolling: slurm-llnl 26.05.5.1-1 Β· GPL-2.0-or-later
- epel 10: slurm 26.05.5-1.el10_3 Β· GPL-2.0-or-later AND BSD-2-Clause AND BSD-1-Clause
- nixpkgs unstable: slurm 26-05-5-1
- ubuntu stonking: slurmrestd 26.05.4-1ubuntu1 Β· GPL-2.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms