Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Pelloin
slurm-tools
Commits
b6181c60
Commit
b6181c60
authored
Sep 21, 2020
by
Valentin Pelloin
Browse files
commit avant refont slurm_add_command & cie
parent
59a96642
Changes
5
Hide whitespace changes
Inline
Side-by-side
bin/get_nodes
View file @
b6181c60
#!/usr/bin/env python3
import
os
import
re
if
not
'SLURM_NODELIST'
in
os
.
environ
:
raise
EnvironmentError
(
'Probably not in a SLURM job'
)
...
...
@@ -10,7 +10,8 @@ base = os.environ['SLURM_NODELIST']
if
'['
in
base
:
types
,
nums
=
base
.
split
(
'['
)
nums
=
nums
.
strip
(
']'
).
split
(
'-'
)
nums
=
re
.
split
(
',|-'
,
nums
.
strip
(
']'
))
# nums = nums.strip(']').split('-')
print
(
" "
.
join
([
types
+
n
for
n
in
nums
]))
else
:
print
(
base
)
bin/get_partition
0 → 100755
View file @
b6181c60
#!/usr/bin/env bash
if
[
"$#"
-ne
"1"
]
;
then
echo
"Usage:
$0
<server name>"
exit
1
fi
server
=
$1
sinfo
-o
'%P %n'
|
grep
$server
|
head
-n1
|
awk
'{print $1;}'
|
sed
-r
"s/
\*
//"
bin/slurm_array_job_start
View file @
b6181c60
#!/bin/sh
sh
$SLURM_SUBMIT_DIR
/.slurm_batch_script_job_
$SLURM_ARRAY_TASK_ID
.sh
ba
sh
$SLURM_SUBMIT_DIR
/.slurm_batch_script_job_
$SLURM_ARRAY_TASK_ID
.sh
bin/slurm_execute
View file @
b6181c60
...
...
@@ -12,6 +12,7 @@ job_name=
time
=
"01-00"
max_parallel
=
10
ranks
=
""
repeat_worker
=
1
.
/lium/buster1/vpelloin/.local/bin/parse_options.sh
...
...
@@ -54,6 +55,16 @@ if [ "$#" -gt 1 ]; then
jobid
=
$(
sbatch
"
${
params
[@]
}
"
slurm_array_job_start
)
echo
" Done!"
elif
[
"
$repeat_worker
"
-gt
1
]
;
then
params+
=(
--wait
)
params+
=(
--parsable
)
params+
=(
--array
"1-
$repeat_worker
%
$max_parallel
"
)
echo
"Starting
$repeat_worker
times the same worker on SLURM..."
jobid
=
$(
sbatch
"
${
params
[@]
}
"
.slurm_batch_script_job_1.sh
)
echo
" Done!"
elif
[
"$#"
==
1
]
;
then
stdout
=
.stdout
$1
params+
=(
--output
$stdout
)
...
...
@@ -81,7 +92,7 @@ elif [ "$#" == 1 ]; then
tail
--pid
$(
jobs
-p
)
-f
$stdout
else
echo
"Not enough jobs given"
exit
1
exit
0
fi
if
$cancel
;
then
...
...
@@ -91,18 +102,19 @@ fi
i
=
1
for
script
in
$@
;
do
rm
.slurm_batch_script_job_
$i
.sh
rm
-f
.slurm_batch_script_job_
$i
.sh
if
[
"$#"
-gt
1
]
;
then
echo
-e
"====
\n
$i
\n
====
"
echo
-e
"====
\n
Job n°
$i
:
"
output
=
slurm-
${
jobid
}
_
${
i
}
.out
if
[
-f
$output
]
;
then
cat
$output
rm
$output
fi
echo
-e
"
\n
"
else
rm
$stdout
if
!
[
-z
$stdout
]
;
then
rm
$stdout
fi
fi
i
=
$((
i
+
1
))
done
...
...
bin/slurm_prepare
View file @
b6181c60
#!/usr/bin/env bash
i
=
$(
echo
$((
$(
find
.
-name
'.slurm_batch_script_job_*'
|
wc
-l
)
+
1
))
)
output
=
".slurm_batch_script_job_
$i
.sh"
(
# Wait for lock on /var/lock/.slurm_prepare.exclusivelock (fd 200) for 30 seconds
flock
-x
-w
30 200
||
exit
1
if
[
-f
"
$output
"
]
;
then
rm
$output
fi
i
=
$(
echo
$((
$(
find
.
-name
'.slurm_batch_script_job_*'
|
wc
-l
)
+
1
))
)
output
=
".slurm_batch_script_job_
$i
.sh"
cat
<
(
echo
-e
"#!/bin/bash
\n
set -e"
)
>
.slurm_batch_script_job_
$i
.sh
if
[
-f
"
$output
"
]
;
then
rm
$output
fi
echo
$output
cat
<
(
echo
-e
"#!/bin/bash
\n
set -e"
)
>
.slurm_batch_script_job_
$i
.sh
for
bash_import
in
$@
;
do
echo
".
$bash_import
"
>>
.slurm_batch_script_job_
$i
.sh
done
echo
$output
)
200>/var/lock/.slurm_prepare.exclusivelock
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment