forked from OleHolmNielsen/Slurm_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschedjobs
executable file
·43 lines (36 loc) · 915 Bytes
/
schedjobs
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
#!/usr/bin/env bash
# Stop or start job scheduling in ALL Slurm partitions
# See https://slurm.schedmd.com/faq.html#stop_sched
# This is used when jobs must be prevented from starting durign a maintenance window.
# Homepage: https://github.com/OleHolmNielsen/Slurm_tools/
# Command usage:
USAGE="Usage: $0 down|up"
if test $# -ne 1
then
echo $USAGE
exit 1
fi
state=$1
if test "$state" != "down" -a "$state" != "up"
then
echo $USAGE
exit 1
fi
if test "$state" = "down"
then
echo
echo NOTICE: Setting partition state=down will be reset if slurmctld is restarted.
echo Read the slurmctld man-page under the -R parameter.
echo
fi
# Find list of ALL Slurm partitions
PARTITIONLIST=`sinfo -h -o "%R"`
# Stop scheduling in each partition separately
for p in $PARTITIONLIST
do
echo Partition $p set to $state
scontrol update PartitionName=$p State=$state
done
echo
echo Current partition status is:
sinfo