|  | #!/usr/bin/env expect | 
|  | ############################################################################ | 
|  | # Purpose: Test of Slurm functionality | 
|  | #          sacctmgr clear (modify) QoS values | 
|  | ############################################################################ | 
|  | # Copyright (C) 2010 Lawrence Livermore National Security. | 
|  | # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). | 
|  | # Written by Joseph Donaghy <donaghy1@llnl.gov> | 
|  | # CODE-OCEC-09-009. All rights reserved. | 
|  | # | 
|  | # This file is part of Slurm, a resource management program. | 
|  | # For details, see <https://slurm.schedmd.com/>. | 
|  | # Please also read the included file: DISCLAIMER. | 
|  | # | 
|  | # 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. | 
|  | # | 
|  | # You should have received a copy of the GNU General Public License along | 
|  | # with Slurm; if not, write to the Free Software Foundation, Inc., | 
|  | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA. | 
|  | ############################################################################ | 
|  | source ./globals_accounting | 
|  |  | 
|  | set test_nu            "test21-29" | 
|  | set usagefactor_reset  1.000000 | 
|  | set priority_reset     0 | 
|  | set access_err         0 | 
|  |  | 
|  | # QoS Limits | 
|  | array set qos {} | 
|  | set qos_name           [format "%s%s" $test_nu "qosnormal"] | 
|  | set qos(GrpCPUMins)    240000 | 
|  | set qos(GrpCPUs)       80 | 
|  | set qos(GrpJobs)       500 | 
|  | set qos(GrpSubmitJobs) 800 | 
|  | set qos(GrpNodes)      10 | 
|  | set qos(GrpWall)       01:00:00 | 
|  | set qos(MaxCPUs)       80 | 
|  | set qos(MaxCPUMins)    60000 | 
|  | set qos(MaxJobs)       50 | 
|  | set qos(MaxSubmitJobs) 100 | 
|  | set qos(MaxNodes)      2 | 
|  | set qos(MaxWall)       01:00:00 | 
|  | set qos(Description)   "tqos1" | 
|  | set qos(Preempt)       "normal" | 
|  | set qos(PreemptMode)   "cluster" | 
|  | set qos(Priority)      2500 | 
|  | set qos(UsageFactor)   5.000000 | 
|  |  | 
|  | set timeout 60 | 
|  |  | 
|  | # | 
|  | # Check accounting config and bail if not found. | 
|  | # | 
|  | if {[get_config_param "AccountingStorageType"] ne "accounting_storage/slurmdbd"} { | 
|  | skip "This test can't be run without a usable AccountStorageType" | 
|  | } | 
|  |  | 
|  | if {[get_admin_level] ne "Administrator"} { | 
|  | skip "This test can't be run without being an Accounting administrator.\nUse: sacctmgr mod user \$USER set admin=admin" | 
|  | } | 
|  |  | 
|  | proc cleanup {} { | 
|  | global qos_name | 
|  |  | 
|  | remove_qos "$qos_name" | 
|  | } | 
|  |  | 
|  | # Make sure we have a clean system and permission to do this work | 
|  | cleanup | 
|  | if {$access_err != 0} { | 
|  | skip "Not authorized to perform this test" | 
|  | } | 
|  |  | 
|  | # Add qos | 
|  | add_qos $qos_name [array get qos] | 
|  |  | 
|  | # Use sacctmgr list to verify the test qos fields | 
|  | check_qos_limits $qos_name [array get qos] | 
|  |  | 
|  | # Setup the qos array so that we clear all the limits | 
|  | foreach option [array name qos] { | 
|  | if {$option ne "PreemptMode" && $option ne "Preempt"} { | 
|  | set qos($option) -1 | 
|  | } | 
|  | } | 
|  | set qos(UsageFactor) $usagefactor_reset | 
|  | set qos(Description) "" | 
|  | set qos(Priority) $priority_reset | 
|  |  | 
|  | # Modify qos | 
|  | if [mod_qos $qos_name [array get qos]] { | 
|  | fail "Unable to modify QOS ($qos_name)" | 
|  | } | 
|  |  | 
|  | # Check that the modified QoS limits are correct | 
|  | check_qos_limits $qos_name [array get qos] |