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
9bcd5077
Commit
9bcd5077
authored
2 years ago
by
Philipp Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
Fix trying to use report-to name for karabo-id when report is skipped
parent
fa628d20
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/xfel_calibrate/finalize.py
+11
-3
11 additions, 3 deletions
src/xfel_calibrate/finalize.py
with
11 additions
and
3 deletions
src/xfel_calibrate/finalize.py
+
11
−
3
View file @
9bcd5077
...
...
@@ -417,7 +417,6 @@ def finalize(joblist, finaljob, run_path, out_path, version, title, author, repo
)
metadata
.
save
()
if
report_to
:
report_to
=
Path
(
report_to
)
prepare_plots
(
run_path
)
...
...
@@ -435,10 +434,19 @@ def finalize(joblist, finaljob, run_path, out_path, version, title, author, repo
# Store the contents of the Slurm working directory next to the report.
# This contains elements needed for reproducibility.
slurm_archive_dir
=
report_to
.
parent
/
f
"
slurm_out_
{
report_to
.
name
}
"
det
=
metadata
[
'
calibration-configurations
'
].
get
(
'
karabo-id
'
,
report_to
.
name
)
else
:
try
:
det
=
metadata
[
'
calibration-configurations
'
][
'
karabo-id
'
]
except
KeyError
:
# Generate a hash based on job IDs to uniquely identify this
# detector.
from
hashlib
import
sha1
det
=
sha1
(
''
.
join
(
joblist
).
encode
(
'
ascii
'
)).
hexdigest
()[:
8
]
# If there is no report location, simply move the slurm_out_
# directory to the output.
slurm_archive_dir
=
Path
(
out_path
)
/
f
"
slurm_out_
{
run_path
.
name
}
"
slurm_archive_dir
=
Path
(
out_path
)
/
f
"
slurm_out_
{
det
}
"
print
(
f
"
Moving temporary files to final location:
{
slurm_archive_dir
}
"
)
move
(
str
(
run_path
),
str
(
slurm_archive_dir
))
# Needs str until Python 3.9
...
...
@@ -448,7 +456,7 @@ def finalize(joblist, finaljob, run_path, out_path, version, title, author, repo
# unique name like calibration_metadata_MID_DET_AGIPD1M-1.yml in the output
# folder. In case they don't, fall back to a name like the report.
# To avoid interleaved writes, we'll copy it to a temp folder, then rename.
det
=
metadata
[
'
calibration-configurations
'
].
get
(
'
karabo-id
'
,
report_to
.
name
)
with
TemporaryDirectory
(
dir
=
out_path
)
as
td
:
tmp_path
=
Path
(
td
,
f
"
calibration_metadata_
{
det
}
.yml
"
)
copy
(
md_path
,
tmp_path
)
...
...
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