API to access and control Slurm.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.0.37
- Package version: 0.0.37.1
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://www.schedmd.com/
Python >= 3.6
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/ccmbioinfo/slurm-rest-py.git
(you may need to run pip
with root permission to install globally: sudo pip install git+https://github.com/ccmbioinfo/slurm-rest-py.git
)
Then import the package:
import slurm_rest
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import slurm_rest
Please follow the installation procedure and then run the following:
#!/usr/bin/env python3
from slurm_rest import Configuration, ApiClient, ApiException
from slurm_rest.apis import SlurmApi
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = slurm_rest.Configuration(
host = "http://localhost"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: token
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# Configure API key authorization: user
configuration.api_key['user'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user'] = 'Bearer'
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = SlurmApi(api_client)
try:
# get diagnostics
print(api_instance.slurmctld_diag())
except slurm_rest.ApiException as e:
print("Exception when calling SlurmApi->slurmctld_diag: %s\n" % e)
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | slurm_v0035_diag_get | GET /slurm/v0.0.35/diag | get diagnostics |
DefaultApi | slurm_v0035_job_job_id_delete | DELETE /slurm/v0.0.35/job/{job_id} | cancel or signal job |
DefaultApi | slurm_v0035_job_job_id_get | GET /slurm/v0.0.35/job/{job_id} | get job info |
DefaultApi | slurm_v0035_job_job_id_post | POST /slurm/v0.0.35/job/{job_id} | update job |
DefaultApi | slurm_v0035_job_submit_post | POST /slurm/v0.0.35/job/submit | submit new job |
DefaultApi | slurm_v0035_jobs_get | GET /slurm/v0.0.35/jobs | get list of jobs |
DefaultApi | slurm_v0035_node_node_name_get | GET /slurm/v0.0.35/node/{node_name} | get node info |
DefaultApi | slurm_v0035_nodes_get | GET /slurm/v0.0.35/nodes | get all node info |
DefaultApi | slurm_v0035_partition_partition_name_get | GET /slurm/v0.0.35/partition/{partition_name} | get partition info |
DefaultApi | slurm_v0035_partitions_get | GET /slurm/v0.0.35/partitions | get all partition info |
DefaultApi | slurm_v0035_ping_get | GET /slurm/v0.0.35/ping | ping test |
OpenapiApi | openapi_get | GET /openapi | Retrieve OpenAPI Specification |
OpenapiApi | openapi_json_get | GET /openapi.json | Retrieve OpenAPI Specification |
OpenapiApi | openapi_v3_get | GET /openapi/v3 | Retrieve OpenAPI Specification |
OpenapiApi | openapi_yaml_get | GET /openapi.yaml | Retrieve OpenAPI Specification |
SlurmApi | slurmctld_cancel_job | DELETE /slurm/v0.0.37/job/{job_id} | cancel or signal job |
SlurmApi | slurmctld_cancel_job_0 | DELETE /slurm/v0.0.36/job/{job_id} | cancel or signal job |
SlurmApi | slurmctld_diag | GET /slurm/v0.0.37/diag | get diagnostics |
SlurmApi | slurmctld_diag_0 | GET /slurm/v0.0.36/diag | get diagnostics |
SlurmApi | slurmctld_get_job | GET /slurm/v0.0.37/job/{job_id} | get job info |
SlurmApi | slurmctld_get_job_0 | GET /slurm/v0.0.36/job/{job_id} | get job info |
SlurmApi | slurmctld_get_jobs | GET /slurm/v0.0.37/jobs | get list of jobs |
SlurmApi | slurmctld_get_jobs_0 | GET /slurm/v0.0.36/jobs | get list of jobs |
SlurmApi | slurmctld_get_node | GET /slurm/v0.0.37/node/{node_name} | get node info |
SlurmApi | slurmctld_get_node_0 | GET /slurm/v0.0.36/node/{node_name} | get node info |
SlurmApi | slurmctld_get_nodes | GET /slurm/v0.0.37/nodes | get all node info |
SlurmApi | slurmctld_get_nodes_0 | GET /slurm/v0.0.36/nodes | get all node info |
SlurmApi | slurmctld_get_partition | GET /slurm/v0.0.37/partition/{partition_name} | get partition info |
SlurmApi | slurmctld_get_partition_0 | GET /slurm/v0.0.36/partition/{partition_name} | get partition info |
SlurmApi | slurmctld_get_partitions | GET /slurm/v0.0.37/partitions | get all partition info |
SlurmApi | slurmctld_get_partitions_0 | GET /slurm/v0.0.36/partitions | get all partition info |
SlurmApi | slurmctld_get_reservation | GET /slurm/v0.0.37/reservation/{reservation_name} | get reservation info |
SlurmApi | slurmctld_get_reservations | GET /slurm/v0.0.37/reservations | get all reservation info |
SlurmApi | slurmctld_ping | GET /slurm/v0.0.37/ping | ping test |
SlurmApi | slurmctld_ping_0 | GET /slurm/v0.0.36/ping | ping test |
SlurmApi | slurmctld_submit_job | POST /slurm/v0.0.37/job/submit | submit new job |
SlurmApi | slurmctld_submit_job_0 | POST /slurm/v0.0.36/job/submit | submit new job |
SlurmApi | slurmctld_update_job | POST /slurm/v0.0.37/job/{job_id} | update job |
SlurmApi | slurmctld_update_job_0 | POST /slurm/v0.0.36/job/{job_id} | update job |
SlurmApi | slurmdbd_add_clusters | POST /slurmdb/v0.0.36/clusters | Add clusters |
SlurmApi | slurmdbd_add_clusters_0 | POST /slurmdb/v0.0.37/clusters | Add clusters |
SlurmApi | slurmdbd_add_wckeys | POST /slurmdb/v0.0.36/wckeys | Add wckeys |
SlurmApi | slurmdbd_add_wckeys_0 | POST /slurmdb/v0.0.37/wckeys | Add wckeys |
SlurmApi | slurmdbd_delete_account | DELETE /slurmdb/v0.0.36/account/{account_name} | Delete account |
SlurmApi | slurmdbd_delete_account_0 | DELETE /slurmdb/v0.0.37/account/{account_name} | Delete account |
SlurmApi | slurmdbd_delete_association | DELETE /slurmdb/v0.0.36/association | Delete association |
SlurmApi | slurmdbd_delete_association_0 | DELETE /slurmdb/v0.0.37/association | Delete association |
SlurmApi | slurmdbd_delete_cluster | DELETE /slurmdb/v0.0.36/cluster/{cluster_name} | Delete cluster |
SlurmApi | slurmdbd_delete_cluster_0 | DELETE /slurmdb/v0.0.37/cluster/{cluster_name} | Delete cluster |
SlurmApi | slurmdbd_delete_qos | DELETE /slurmdb/v0.0.36/qos/{qos_name} | Delete QOS |
SlurmApi | slurmdbd_delete_qos_0 | DELETE /slurmdb/v0.0.37/qos/{qos_name} | Delete QOS |
SlurmApi | slurmdbd_delete_user | DELETE /slurmdb/v0.0.36/user/{user_name} | Delete user |
SlurmApi | slurmdbd_delete_user_0 | DELETE /slurmdb/v0.0.37/user/{user_name} | Delete user |
SlurmApi | slurmdbd_delete_wckey | DELETE /slurmdb/v0.0.36/wckey/{wckey} | Delete wckey |
SlurmApi | slurmdbd_delete_wckey_0 | DELETE /slurmdb/v0.0.37/wckey/{wckey} | Delete wckey |
SlurmApi | slurmdbd_diag | GET /slurmdb/v0.0.36/diag | Get slurmdb diagnostics |
SlurmApi | slurmdbd_diag_0 | GET /slurmdb/v0.0.37/diag | Get slurmdb diagnostics |
SlurmApi | slurmdbd_get_account | GET /slurmdb/v0.0.36/account/{account_name} | Get account info |
SlurmApi | slurmdbd_get_account_0 | GET /slurmdb/v0.0.37/account/{account_name} | Get account info |
SlurmApi | slurmdbd_get_accounts | GET /slurmdb/v0.0.36/accounts | Get account list |
SlurmApi | slurmdbd_get_accounts_0 | GET /slurmdb/v0.0.37/accounts | Get account list |
SlurmApi | slurmdbd_get_association | GET /slurmdb/v0.0.36/association | Get association info |
SlurmApi | slurmdbd_get_association_0 | GET /slurmdb/v0.0.37/association | Get association info |
SlurmApi | slurmdbd_get_associations | GET /slurmdb/v0.0.36/associations | Get association list |
SlurmApi | slurmdbd_get_associations_0 | GET /slurmdb/v0.0.37/associations | Get association list |
SlurmApi | slurmdbd_get_cluster | GET /slurmdb/v0.0.36/cluster/{cluster_name} | Get cluster info |
SlurmApi | slurmdbd_get_cluster_0 | GET /slurmdb/v0.0.37/cluster/{cluster_name} | Get cluster info |
SlurmApi | slurmdbd_get_clusters | GET /slurmdb/v0.0.36/clusters | Get cluster list |
SlurmApi | slurmdbd_get_clusters_0 | GET /slurmdb/v0.0.37/clusters | Get cluster list |
SlurmApi | slurmdbd_get_db_config | GET /slurmdb/v0.0.36/config | Dump all configuration information |
SlurmApi | slurmdbd_get_db_config_0 | GET /slurmdb/v0.0.37/config | Dump all configuration information |
SlurmApi | slurmdbd_get_job | GET /slurmdb/v0.0.36/job/{job_id} | Get job info |
SlurmApi | slurmdbd_get_job_0 | GET /slurmdb/v0.0.37/job/{job_id} | Get job info |
SlurmApi | slurmdbd_get_jobs | GET /slurmdb/v0.0.36/jobs | Get job list |
SlurmApi | slurmdbd_get_jobs_0 | GET /slurmdb/v0.0.37/jobs | Get job list |
SlurmApi | slurmdbd_get_qos | GET /slurmdb/v0.0.36/qos | Get QOS list |
SlurmApi | slurmdbd_get_qos_0 | GET /slurmdb/v0.0.37/qos | Get QOS list |
SlurmApi | slurmdbd_get_single_qos | GET /slurmdb/v0.0.36/qos/{qos_name} | Get QOS info |
SlurmApi | slurmdbd_get_single_qos_0 | GET /slurmdb/v0.0.37/qos/{qos_name} | Get QOS info |
SlurmApi | slurmdbd_get_tres | GET /slurmdb/v0.0.36/tres | Get TRES info |
SlurmApi | slurmdbd_get_tres_0 | GET /slurmdb/v0.0.37/tres | Get TRES info |
SlurmApi | slurmdbd_get_user | GET /slurmdb/v0.0.36/user/{user_name} | Get user info |
SlurmApi | slurmdbd_get_user_0 | GET /slurmdb/v0.0.37/user/{user_name} | Get user info |
SlurmApi | slurmdbd_get_users | GET /slurmdb/v0.0.36/users | Get user list |
SlurmApi | slurmdbd_get_users_0 | GET /slurmdb/v0.0.37/users | Get user list |
SlurmApi | slurmdbd_get_wckey | GET /slurmdb/v0.0.36/wckey/{wckey} | Get wckey info |
SlurmApi | slurmdbd_get_wckey_0 | GET /slurmdb/v0.0.37/wckey/{wckey} | Get wckey info |
SlurmApi | slurmdbd_get_wckeys | GET /slurmdb/v0.0.36/wckeys | Get wckey list |
SlurmApi | slurmdbd_get_wckeys_0 | GET /slurmdb/v0.0.37/wckeys | Get wckey list |
SlurmApi | slurmdbd_set_db_config | POST /slurmdb/v0.0.36/config | Load all configuration information |
SlurmApi | slurmdbd_set_db_config_0 | POST /slurmdb/v0.0.37/config | Load all configuration information |
SlurmApi | slurmdbd_update_account | POST /slurmdb/v0.0.36/accounts | Update accounts |
SlurmApi | slurmdbd_update_account_0 | POST /slurmdb/v0.0.37/accounts | Update accounts |
SlurmApi | slurmdbd_update_tres | POST /slurmdb/v0.0.36/tres | Set TRES info |
SlurmApi | slurmdbd_update_tres_0 | POST /slurmdb/v0.0.37/tres | Set TRES info |
SlurmApi | slurmdbd_update_users | POST /slurmdb/v0.0.36/users | Update user |
SlurmApi | slurmdbd_update_users_0 | POST /slurmdb/v0.0.37/users | Update user |
- Dbv0036Account
- Dbv0036AccountInfo
- Dbv0036AccountResponse
- Dbv0036Association
- Dbv0036AssociationDefault
- Dbv0036AssociationMax
- Dbv0036AssociationMaxJobs
- Dbv0036AssociationMaxJobsPer
- Dbv0036AssociationMaxPer
- Dbv0036AssociationMaxPerAccount
- Dbv0036AssociationMaxTres
- Dbv0036AssociationMaxTresMinutes
- Dbv0036AssociationMaxTresMinutesPer
- Dbv0036AssociationMaxTresPer
- Dbv0036AssociationMin
- Dbv0036AssociationShortInfo
- Dbv0036AssociationUsage
- Dbv0036AssociationsInfo
- Dbv0036ClusterInfo
- Dbv0036ClusterInfoAssociations
- Dbv0036ClusterInfoController
- Dbv0036ConfigInfo
- Dbv0036ConfigResponse
- Dbv0036CoordinatorInfo
- Dbv0036Diag
- Dbv0036DiagRPCs
- Dbv0036DiagRollups
- Dbv0036DiagTime
- Dbv0036DiagTime1
- Dbv0036DiagUsers
- Dbv0036Error
- Dbv0036Job
- Dbv0036JobArray
- Dbv0036JobArrayLimits
- Dbv0036JobArrayLimitsMax
- Dbv0036JobArrayLimitsMaxRunning
- Dbv0036JobComment
- Dbv0036JobExitCode
- Dbv0036JobExitCodeSignal
- Dbv0036JobHet
- Dbv0036JobInfo
- Dbv0036JobMcs
- Dbv0036JobRequired
- Dbv0036JobReservation
- Dbv0036JobState
- Dbv0036JobStep
- Dbv0036JobStepCPU
- Dbv0036JobStepCPURequestedFrequency
- Dbv0036JobStepNodes
- Dbv0036JobStepStatistics
- Dbv0036JobStepStatisticsCPU
- Dbv0036JobStepStatisticsEnergy
- Dbv0036JobStepStep
- Dbv0036JobStepStepHet
- Dbv0036JobStepStepTask
- Dbv0036JobStepStepTres
- Dbv0036JobStepStepTresRequested
- Dbv0036JobStepTasks
- Dbv0036JobStepTime
- Dbv0036JobTime
- Dbv0036JobTimeSystem
- Dbv0036JobTimeTotal
- Dbv0036JobTimeUser
- Dbv0036JobTres
- Dbv0036JobWckey
- Dbv0036Qos
- Dbv0036QosInfo
- Dbv0036QosLimits
- Dbv0036QosLimitsMax
- Dbv0036QosLimitsMaxAccruing
- Dbv0036QosLimitsMaxAccruingPer
- Dbv0036QosLimitsMaxJobs
- Dbv0036QosLimitsMaxJobsPer
- Dbv0036QosLimitsMaxTres
- Dbv0036QosLimitsMaxTresMinutes
- Dbv0036QosLimitsMaxTresMinutesPer
- Dbv0036QosLimitsMaxTresPer
- Dbv0036QosLimitsMaxWallClock
- Dbv0036QosLimitsMaxWallClockPer
- Dbv0036QosLimitsMin
- Dbv0036QosLimitsMinTres
- Dbv0036QosLimitsMinTresPer
- Dbv0036QosPreempt
- Dbv0036ResponseAccountDelete
- Dbv0036ResponseAssociationDelete
- Dbv0036ResponseClusterAdd
- Dbv0036ResponseClusterDelete
- Dbv0036ResponseQosDelete
- Dbv0036ResponseTres
- Dbv0036ResponseUserDelete
- Dbv0036ResponseUserUpdate
- Dbv0036ResponseWckeyAdd
- Dbv0036ResponseWckeyDelete
- Dbv0036TresInfo
- Dbv0036TresList
- Dbv0036User
- Dbv0036UserAssociations
- Dbv0036UserDefault
- Dbv0036UserInfo
- Dbv0036Wckey
- Dbv0036WckeyInfo
- Dbv0037Account
- Dbv0037AccountInfo
- Dbv0037AccountResponse
- Dbv0037Association
- Dbv0037AssociationMax
- Dbv0037AssociationMaxTres
- Dbv0037AssociationMaxTresMinutes
- Dbv0037AssociationMaxTresMinutesPer
- Dbv0037AssociationMaxTresPer
- Dbv0037AssociationShortInfo
- Dbv0037AssociationsInfo
- Dbv0037ClusterInfo
- Dbv0037ClusterInfoAssociations
- Dbv0037ConfigInfo
- Dbv0037ConfigResponse
- Dbv0037CoordinatorInfo
- Dbv0037Diag
- Dbv0037Error
- Dbv0037Job
- Dbv0037JobExitCode
- Dbv0037JobInfo
- Dbv0037JobState
- Dbv0037JobStep
- Dbv0037JobStepStep
- Dbv0037JobStepStepTres
- Dbv0037JobStepStepTresRequested
- Dbv0037JobTres
- Dbv0037Qos
- Dbv0037QosInfo
- Dbv0037QosLimits
- Dbv0037QosLimitsMax
- Dbv0037QosLimitsMaxTres
- Dbv0037QosLimitsMaxTresMinutes
- Dbv0037QosLimitsMaxTresMinutesPer
- Dbv0037QosLimitsMaxTresPer
- Dbv0037QosLimitsMin
- Dbv0037QosLimitsMinTres
- Dbv0037QosLimitsMinTresPer
- Dbv0037ResponseAccountDelete
- Dbv0037ResponseAssociationDelete
- Dbv0037ResponseClusterAdd
- Dbv0037ResponseClusterDelete
- Dbv0037ResponseQosDelete
- Dbv0037ResponseTres
- Dbv0037ResponseUserDelete
- Dbv0037ResponseUserUpdate
- Dbv0037ResponseWckeyAdd
- Dbv0037ResponseWckeyDelete
- Dbv0037TresInfo
- Dbv0037TresList
- Dbv0037User
- Dbv0037UserAssociations
- Dbv0037UserInfo
- Dbv0037Wckey
- Dbv0037WckeyInfo
- JobProperties
- Signal
- SignalOneOf
- V0036Diag
- V0036Error
- V0036JobProperties
- V0036JobResources
- V0036JobResponseProperties
- V0036JobSubmission
- V0036JobSubmissionResponse
- V0036JobsResponse
- V0036Node
- V0036NodeAllocation
- V0036NodesResponse
- V0036Partition
- V0036PartitionsResponse
- V0036Ping
- V0036Pings
- V0036Signal
- V0037Diag
- V0037DiagStatistics
- V0037Error
- V0037JobProperties
- V0037JobResources
- V0037JobResponseProperties
- V0037JobSubmission
- V0037JobSubmissionResponse
- V0037JobsResponse
- V0037Node
- V0037NodeAllocation
- V0037NodesResponse
- V0037Partition
- V0037PartitionsResponse
- V0037Ping
- V0037Pings
- V0037Reservation
- V0037ReservationPurgeCompleted
- V0037ReservationsResponse
- V0037Signal
- Type: API key
- API key parameter name: X-SLURM-USER-TOKEN
- Location: HTTP header
- Type: API key
- API key parameter name: X-SLURM-USER-NAME
- Location: HTTP header
If the OpenAPI document is large, imports in slurm_rest.apis and slurm_rest.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
Solution 1: Use specific imports for apis and models like:
from slurm_rest.api.default_api import DefaultApi
from slurm_rest.model.pet import Pet
Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:
import sys
sys.setrecursionlimit(1500)
import slurm_rest
from slurm_rest.apis import *
from slurm_rest.models import *
Download Slurm's OpenAPI schema at /openapi.json
(all forms of this endpoint
return the exact same document) to openapi-slurm.json
, then run the generator:
docker run --rm \
--user $(id -u):$(id -g) \
-v $PWD:/srv \
openapitools/openapi-generator-cli:v5.3.0 \
generate \
-i /srv/openapi-slurm.json \
-g python \
--skip-validate-spec \
-o /srv/SUBDIRECTORY_OF_PWD_IF_NEEDED \
--package-name slurm_rest \
--git-user-id ccmbioinfo \
--git-repo-id slurm-rest-py \
--additional-properties packageVersion=0.0.37.0
I used Docker to run the CLI for convenience, but it can be run in other ways.
The Slurm schema has some validation errors with repeated attributes, so we have
to skip that step to generate the client, which seems to work regardless. We use
a bind mount for the container to write local files, and additionally use our
current UID and GID with the container so the files aren't written out as root.
This can be run in the repository root or its parent directory, as long as the
-o
output path is adjusted accordingly.