1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
#!/usr/bin/env expect
############################################################################
# Purpose: Test of Slurm functionality
# to be called from test21.30
# Tests if the GrpCPUmins limit is enforced
############################################################################
# Copyright (C) 2014 SchedMD LLC
# Written by Nathan Yee <nyee32@schedmd.com>
#
# 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.
############################################################################
# Test GrpCPUmins
proc inc21_30_9 { wait_reason } {
global salloc srun nthreads acct bin_sleep grpcpumin_num number
global totcpus test_node qostest
log_info "Starting GrpCpuMins test "
if {![param_contains [get_config_param "AccountingStorageEnforce"] "safe"]} {
log_warn "This test can't be run without AccountingStorageEnforce having \"safe\" in it"
return
}
set job_id1 0
set job_id2 0
# Raise an error to abort the catch block
set exception_code [catch {
set timeout [expr $grpcpumin_num * 120]
set timelimit [expr $grpcpumin_num / $nthreads]
# Since GrpCpuMins is a decayed variable lets reset it to make sure
# the test gets exactly what we would expect.
if [reset_qos_usage "" $qostest] {
error "Unable to reset QOS usage"
}
spawn $salloc --account=$acct -w$test_node --qos=$qostest -n$nthreads -t$timelimit $srun $bin_sleep 1
expect {
-re "Granted job allocation ($number)" {
set job_id1 $expect_out(1,string)
log_debug "Job $job_id1 has been submitted"
}
-re "Pending job allocation ($number)" {
set job_id1 $expect_out(1,string)
error "This job should not be pending"
}
-re "error" {
error "Job allocation should not have failed"
}
timeout {
error "salloc not responding"
}
eof {
wait
}
}
cancel_job $job_id1
if [reset_qos_usage "" $qostest] {
error "Unable to reset QOS usage"
}
spawn $salloc --account=$acct -w$test_node --qos=$qostest -n$nthreads -t[expr $timelimit + 1] $srun $bin_sleep 1
expect {
-re "Pending job allocation ($number)" {
set job_id2 $expect_out(1,string)
log_debug "Job $job_id2 is waiting for resources. This is expected"
}
-re "Granted job allocation ($number)" {
set job_id2 $expect_out(1,string)
error "Job should be pending but is not"
}
timeout {
error "salloc not responding"
}
eof {
wait
}
}
subtest [check_reason $job_id2 $wait_reason] "Job should have wait reason $wait_reason"
} message] ; # Store the error message in $message
cancel_job $job_id2
# Convert any errors into failures (after cleaning up)
if {$exception_code == 1} { ; # errors only
fail "Failure testing $wait_reason: $message"
}
}
|