Skip to content
Snippets Groups Projects
Commit 5b0304f0 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Finalize script in Python

parent a435c457
No related branches found
No related tags found
1 merge request!350Simplify how batch jobs find Python tools
...@@ -59,6 +59,6 @@ fi ...@@ -59,6 +59,6 @@ fi
if [ "${final}" == "FINAL" ] if [ "${final}" == "FINAL" ]
then then
XFEL_CALIBRATE_PYTHON="${python_path}" ${finalize} $SLURM_JOB_ID ${python_path} ${finalize} $SLURM_JOB_ID
fi fi
killall -9 cal_influx_feeder.sh || true killall -9 cal_influx_feeder.sh || true
...@@ -500,17 +500,15 @@ def create_finalize_script(fmt_args, temp_path, job_list): ...@@ -500,17 +500,15 @@ def create_finalize_script(fmt_args, temp_path, job_list):
""" """
Create a finalize script to produce output report Create a finalize script to produce output report
:param fmt_args: Dictionary of fmt arguments :param fmt_args: Dictionary of fmt arguments
:param temp_path: Path to temopary folder to run slurm job :param temp_path: Path to temporary folder to run slurm job
:param job_list: List of slurm jobs :param job_list: List of slurm jobs
""" """
tmpl = Template(''' tmpl = Template('''
#!/bin/tcsh import sys
source /etc/profile.d/modules.sh from xfel_calibrate.finalize import finalize
module load texlive/2019
echo 'Running finalize script'
"${XFEL_CALIBRATE_PYTHON}" -c "from xfel_calibrate.finalize import finalize;
finalize(joblist={{joblist}}, finalize(joblist={{joblist}},
finaljob=$1, finaljob=sys.argv[1],
run_path='{{run_path}}', run_path='{{run_path}}',
out_path='{{out_path}}', out_path='{{out_path}}',
project='{{project}}', project='{{project}}',
...@@ -525,7 +523,7 @@ def create_finalize_script(fmt_args, temp_path, job_list): ...@@ -525,7 +523,7 @@ def create_finalize_script(fmt_args, temp_path, job_list):
''') ''')
fmt_args['joblist'] = job_list fmt_args['joblist'] = job_list
f_name = os.path.join(temp_path, "finalize.sh") f_name = os.path.join(temp_path, "finalize.py")
with open(f_name, "w") as finfile: with open(f_name, "w") as finfile:
finfile.write(textwrap.dedent(tmpl.render(**fmt_args))) finfile.write(textwrap.dedent(tmpl.render(**fmt_args)))
...@@ -658,7 +656,7 @@ def concurrent_run(temp_path, nb, nbname, args, cparm=None, cval=None, ...@@ -658,7 +656,7 @@ def concurrent_run(temp_path, nb, nbname, args, cparm=None, cval=None,
'"{}"'.format(args["detector"].upper()), '"{}"'.format(args["detector"].upper()),
'"{}"'.format(args["type"].upper()), '"{}"'.format(args["type"].upper()),
"FINAL" if final_job else "NONFINAL", "FINAL" if final_job else "NONFINAL",
". {}/finalize.sh".format(os.path.abspath(temp_path)), "{}/finalize.py".format(os.path.abspath(temp_path)),
str(cluster_cores)] str(cluster_cores)]
output = check_output(srun_base).decode('utf8') output = check_output(srun_base).decode('utf8')
......
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