Skip to content
Snippets Groups Projects
Commit 6adc6b7a authored by Philipp Schmidt's avatar Philipp Schmidt
Browse files

Add warning to xfel-calibrate if configuration may cause result to not be reproducible

parent 85ddd210
No related branches found
No related tags found
1 merge request!588Add warning if xfel-calibrate may not be reproducible
......@@ -985,6 +985,34 @@ def run():
caltype = args["type"].upper()
sequential = args["no_cluster_job"]
# Pick out any arguments that may prevent reproducibility from
# working, sorted alphabetically and converted back to their
# canonical representation.
not_reproducible_args = sorted(
('--' + x.replace('_', '-')
for x in ['skip_report', 'skip_env_freeze']
if args[x]))
# If any of these arguments are set, present a warning.
if not_reproducible_args:
print('WARNING: One or more command line arguments ({}) may prevent '
'this specific correction result from being reproducible based '
'on its metadata. It may not be possible to restore identical '
'output data files when they have been deleted or lost. Please '
'ensure that the data retention policy of the chosen storage '
'location is sufficient for your '
'needs.'.format(', '.join(not_reproducible_args)))
try:
input('Press ENTER to continue or CTRL+C to abort...')
except KeyboardInterrupt:
# Catch the interrupt and silently exit.
sys.exit(0)
reproducible = False
else:
reproducible = True
try:
nb_info = notebooks[detector][caltype]
except KeyError:
......@@ -1100,6 +1128,7 @@ def run():
metadata["pycalibration-version"] = version
metadata["report-path"] = f"{report_to}.pdf" if report_to \
else '# REPORT SKIPPED #'
metadata['reproducible'] = reproducible
metadata["concurrency"] = {
'parameter': concurrency_par,
'default': concurrency_defval,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment