Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
calibration
pycalibration
Commits
61688e6d
Commit
61688e6d
authored
3 years ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Initial work towards re-running calibration job
parent
4e26f4df
No related branches found
No related tags found
1 merge request
!544
Reproducibility, step 1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/xfel_calibrate/repeat.py
+40
-0
40 additions, 0 deletions
src/xfel_calibrate/repeat.py
with
40 additions
and
0 deletions
src/xfel_calibrate/repeat.py
0 → 100644
+
40
−
0
View file @
61688e6d
import
argparse
import
json
import
sys
from
datetime
import
datetime
from
pathlib
import
Path
from
shutil
import
copytree
from
.calibrate
import
Step
,
JobGroup
,
SlurmOptions
from
.settings
import
temp_path
def
main
(
argv
=
None
):
ap
=
argparse
.
ArgumentParser
()
ap
.
add_argument
(
"
from_dir
"
,
help
=
"
A directory containing exec_details.json
"
)
ap
.
add_argument
(
"
--python
"
,
help
=
"
Path to Python executable to run notebooks
"
)
ap
.
add_argument
(
"
--slurm-partition
"
,
help
=
"
Submit jobs in this Slurm partition
"
)
ap
.
add_argument
(
'
--no-cluster-job
'
,
action
=
"
store_true
"
,
help
=
"
Run notebooks here, not in cluster jobs
"
)
args
=
ap
.
parse_args
(
argv
)
run_uuid
=
f
"
t
{
datetime
.
now
()
:
%
y
%
m
%
d_
%
H
%
M
%
S
}
"
working_dir
=
Path
(
temp_path
,
f
'
slurm_out_repeat_
{
run_uuid
}
'
)
copytree
(
args
.
from_dir
,
working_dir
)
exec_details
=
json
.
loads
((
working_dir
/
'
exec_details.json
'
).
read_text
(
'
utf-8
'
))
job_group
=
JobGroup
(
[
Step
.
from_dict
(
d
)
for
d
in
exec_details
[
'
steps
'
]],
run_tmp_path
=
str
(
working_dir
),
python
=
(
args
.
python
or
sys
.
executable
),
)
if
args
.
no_cluster_job
:
job_group
.
run_direct
()
else
:
job_group
.
submit_jobs
(
SlurmOptions
(
partition
=
args
.
slurm_partition
,
))
if
__name__
==
'
__main__
'
:
sys
.
exit
(
main
())
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment