buildtest.scheduler.detection
Module Contents
Classes
This is a base Scheduler class used for implementing common methods for |
|
The Slurm class implements common functions to query Slurm cluster |
|
The LSF class checks for LSF binaries and returns a list of LSF queues |
|
The PBS class checks for PBS binaries and gets a list of available queues |
|
The Torque class for detecting Torque Scheduler and getting list of queues. |
- class buildtest.scheduler.detection.Scheduler(custom_dirs=None)[source]
This is a base Scheduler class used for implementing common methods for detecting Scheduler details. The subclass implements specific queries that are scheduler specific.
- logger
- binaries = []
- class buildtest.scheduler.detection.Slurm(custom_dirs=None)[source]
Bases:
Scheduler
The Slurm class implements common functions to query Slurm cluster including partitions, qos, cluster. We check existence of slurm binaries in $PATH and return if slurm cluster is in valid state.
- binaries = ['sbatch', 'sacct', 'sacctmgr', 'sinfo', 'scancel', 'scontrol']
- _get_partitions()[source]
Get list of all partitions slurm partitions using
sinfo -a -h -O partitionname
. The output is a list of queue names$ sinfo -a -h -O partitionname system system_shared debug_hsw debug_knl jupyter
- _get_clusters()[source]
Get list of slurm clusters by running
sacctmgr list cluster -P -n format=Cluster
. The output is a list of slurm clusters something as follows$ sacctmgr list cluster -P -n format=Cluster cori escori
- _get_qos()[source]
Retrieve a list of all slurm qos by running
sacctmgr list qos -P -n format=Name
. The output is a list of qos. Shown below is an example output$ sacctmgr list qos -P -n format=Name normal premium low serialize scavenger
- validate_cluster(executor, slurm_executor)[source]
This method will validate a cluster for a given executor. If ‘cluster’ key is defined in slurm executor configuration we will check if cluster is valid, if so we return True otherwise we return False.
- class buildtest.scheduler.detection.LSF(custom_dirs=None)[source]
Bases:
Scheduler
The LSF class checks for LSF binaries and returns a list of LSF queues
- binaries = ['bsub', 'bqueues', 'bkill', 'bjobs']
- get_queues()[source]
Return json dictionary of available LSF Queues and their queue states. The command we run is the following:
bqueues -o 'queue_name status' -json
which returns a JSON record of all queue details.$ bqueues -o 'queue_name status' -json { "COMMAND":"bqueues", "QUEUES":2, "RECORDS":[ { "QUEUE_NAME":"batch", "STATUS":"Open:Active" }, { "QUEUE_NAME":"test", "STATUS":"Open:Active" } ] }
- class buildtest.scheduler.detection.PBS(custom_dirs=None)[source]
Bases:
Scheduler
The PBS class checks for PBS binaries and gets a list of available queues
- binaries = ['qsub', 'qstat', 'qdel', 'qhold', 'qmgr']
- check(custom_dirs=None)[source]
Check if binaries exist in $PATH and run
qsub --version
to see output to determine if its OpenPBS scheduler. The return will be a boolean type whereTrue
indicates the check has passed.Output of
qsub --version
from OpenPBS scheduler would be as follows, we will search for string pbs_version[pbsuser@pbs tmp]$ qsub –version pbs_version = 19.0.0
- Parameters:
binaries (list) – list of binaries to check for existence in $PATH
- get_queues()[source]
Get queue configuration using
qstat -Q -f -F json
and retrieve a list of queues.Shown below is an example output of
qstat -Q -f -F json
$ qstat -Q -f -F json { "timestamp":1615924938, "pbs_version":"19.0.0", "pbs_server":"pbs", "Queue":{ "workq":{ "queue_type":"Execution", "total_jobs":0, "state_count":"Transit:0 Queued:0 Held:0 Waiting:0 Running:0 Exiting:0 Begun:0 ", "resources_assigned":{ "mem":"0kb", "ncpus":0, "nodect":0 }, "hasnodes":"True", "enabled":"True", "started":"True" } } }
- class buildtest.scheduler.detection.Torque(custom_dirs=None)[source]
Bases:
Scheduler
The Torque class for detecting Torque Scheduler and getting list of queues.
- binaries = ['qsub', 'qstat', 'qdel', 'qhold', 'qmgr']
- check(custom_dirs=None)[source]
Check if binaries exist in $PATH and run
qsub --version
to see output if its Torque Scheduler. The return will be a boolean type whereTrue
indicates the check has passed.Output from
qsub --version
from Torque scheduler would be as follows, we will search for Commit: in output to distinguish Torque from OpenPBS$ qsub --version Version: 7.0.1 Commit: b405f8c22d41d29cbf9b9016bc1146bf4559e895
- Parameters:
binaries (list) – list of binaries to check for existence in $PATH
- get_queues()[source]
Get queue configuration using ‘qstat -Qf’ and parse the output into a JSON dictionary. The output of this command will be as follows
$ qstat -Qf Queue: lbl-cluster queue_type = Execution total_jobs = 0 state_count = Transit:0 Queued:0 Held:0 Waiting:0 Running:0 Exiting:0 Complete:0 resources_default.nodes = 1 resources_default.walltime = 24:00:00 mtime = 1711400391 enabled = True started = True