diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py index 353d2d8d1d800dadaffafb42746acad4fdd49bc4..ebfae99317ddde50db7534a91633c26f854d2f46 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(),