From 37786afb8670ec262f16975069e9cafe4335e49d Mon Sep 17 00:00:00 2001 From: Thomas Kluyver <thomas@kluyver.me.uk> Date: Thu, 10 Sep 2020 10:03:19 +0100 Subject: [PATCH] Run all Python subprocesses with the same Python --- bin/slurm_calibrate.sh | 2 +- xfel_calibrate/calibrate.py | 2 +- xfel_calibrate/finalize.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/slurm_calibrate.sh b/bin/slurm_calibrate.sh index d5e87ebc3..a08838922 100755 --- a/bin/slurm_calibrate.sh +++ b/bin/slurm_calibrate.sh @@ -59,6 +59,6 @@ fi if [ "${final}" == "FINAL" ] then - ${finalize} $SLURM_JOB_ID + XFEL_CALIBRATE_PYTHON="${python_path}" ${finalize} $SLURM_JOB_ID fi killall -9 cal_influx_feeder.sh || true diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py index 352c4ca3b..2134bfdba 100755 --- a/xfel_calibrate/calibrate.py +++ b/xfel_calibrate/calibrate.py @@ -508,7 +508,7 @@ def create_finalize_script(fmt_args, temp_path, job_list): source /etc/profile.d/modules.sh module load texlive/2019 echo 'Running finalize script' - python3 -c "from xfel_calibrate.finalize import finalize; + "${XFEL_CALIBRATE_PYTHON}" -c "from xfel_calibrate.finalize import finalize; finalize(joblist={{joblist}}, finaljob=$1, run_path='{{run_path}}', diff --git a/xfel_calibrate/finalize.py b/xfel_calibrate/finalize.py index 53bc72912..5c96202fb 100644 --- a/xfel_calibrate/finalize.py +++ b/xfel_calibrate/finalize.py @@ -209,7 +209,7 @@ def make_report(run_path, tmp_path, out_path, project, author, version, out_path = report_path try: - check_call(["sphinx-quickstart", + check_call([sys.executable, "-m", "sphinx.quickstart", "--quiet", "--project='{}'".format(project), "--author='{}'".format(author), @@ -222,7 +222,7 @@ def make_report(run_path, tmp_path, out_path, project, author, version, "--no-batchfile", run_path]) except CalledProcessError: - raise Exception("Failed to run sphinx-quickbuild. Is sphinx installed?" + raise Exception("Failed to run sphinx-quickstart. Is sphinx installed?" "Generated simple index.rst instead") # quickbuild went well we need to edit the index.rst and conf.py files @@ -299,7 +299,7 @@ def make_report(run_path, tmp_path, out_path, project, author, version, # finally call the make scripts chdir(run_path) try: - check_call(["make", "latexpdf"]) + check_call(["make", f"SPHINXBUILD={sys.executable} -m sphinx", "latexpdf"]) except CalledProcessError: print("Failed to make pdf documentation") -- GitLab