Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
6d803cca
Commit
6d803cca
authored
Nov 04, 2020
by
Antoine Kaufmann
Browse files
experiments: record job ids in slurm runtime
Will be useful for checkpoints
parent
f012bd04
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
experiments/modes/runtime.py
experiments/modes/runtime.py
+13
-1
No files found.
experiments/modes/runtime.py
View file @
6d803cca
...
...
@@ -2,6 +2,7 @@ import asyncio
import
pickle
import
os
import
pathlib
import
re
import
modes.experiments
as
exp
...
...
@@ -173,6 +174,17 @@ class SlurmRuntime(Runtime):
def
start
(
self
):
pathlib
.
Path
(
self
.
slurmdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
jid_re
=
re
.
compile
(
r
'Submitted batch job ([0-9]+)'
)
for
run
in
self
.
runnable
:
script
=
self
.
prep_run
(
run
)
os
.
system
(
'sbatch '
+
script
)
stream
=
os
.
popen
(
'sbatch '
+
script
)
output
=
stream
.
read
()
result
=
stream
.
close
()
if
result
is
not
None
:
raise
Exception
(
'running sbatch failed'
)
m
=
jid_re
.
search
(
output
)
run
.
job_id
=
int
(
m
.
group
(
1
))
Write
Preview
Markdown
is supported
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