From cb5420d9839a65c5f14b6ffcc534f35981df83ff Mon Sep 17 00:00:00 2001 From: karnem <mikhail.karnevskiy@xfel.eu> Date: Thu, 19 Mar 2020 16:31:13 +0100 Subject: [PATCH] Save command line to execute xfel_calibrate --- xfel_calibrate/calibrate.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py index 353d2d8d1..ebfae9931 100755 --- a/xfel_calibrate/calibrate.py +++ b/xfel_calibrate/calibrate.py @@ -543,6 +543,20 @@ def create_finalize_script(fmt_args, temp_path, job_list): os.chmod(f_name, all_stats) +def save_executed_command(run_tmp_path, version): + """ + Create a file with string used to execute `xfel_calibrate` + + :param run_tmp_path: path to temporary directory for running job outputs + :parm version: git version of the pycalibration package + """ + + f_name = "{}/run_calibrate.sh".format(run_tmp_path) + with open(f_name, "w") as finfile: + finfile.write(f'# pycalibration version: {version}\n') + finfile.write(' '.join(sys.argv)) + + def get_launcher_command(args, temp_path, dependent, job_list): """ Return a slurm launcher command @@ -826,6 +840,7 @@ def run(): # Write all input parameters to rst file to be included to final report parms = parameter_values(parms, **args) make_par_table(parms, temp_path, run_uuid) + save_executed_command(run_tmp_path, version) # wait on all jobs to run and then finalize the run by creating a report from the notebooks out_path = "{}/{}/{}/{}".format(report_path, detector.upper(), -- GitLab