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

Copy bash script to run notebook to working directory

parent cd10351a
No related branches found
No related tags found
1 merge request!544Reproducibility, step 1
#!/bin/bash
# This script is used to run a parameterised copy of a Jupyter notebook. It is
# typically run through Slurm with the sbatch command.
set -euo pipefail
......
......@@ -8,6 +8,7 @@ import math
import os
import pprint
import re
import shutil
import stat
import string
import sys
......@@ -771,7 +772,7 @@ def prepare_job(
nbformat.write(new_nb, nbpath)
return JobArgs([
"{pkg_dir}/bin/slurm_calibrate.sh",
"pycalib-run-nb.sh",
new_name,
"{python}",
cluster_profile,
......@@ -793,9 +794,7 @@ class JobArgs:
return isinstance(other, JobArgs) and (self.args == other.args)
def format_cmd(self, python):
return [a.format(
python=python, pkg_dir=PKG_DIR
) for a in self.args]
return [a.format(python=python) for a in self.args]
def run_direct(self, work_dir, python) -> int:
return call(self.format_cmd(python), cwd=work_dir)
......@@ -1014,6 +1013,12 @@ def run():
# And save the invocation of this script itself
save_executed_command(run_tmp_path, version)
# Copy the bash script which will be used to run notebooks
shutil.copy2(
os.path.join(PKG_DIR, "bin", "slurm_calibrate.sh"),
os.path.join(run_tmp_path, "pycalib-run-nb.sh")
)
# wait on all jobs to run and then finalize the run by creating a report from the notebooks
out_path = Path(default_report_path) / detector.upper() / caltype.upper() / datetime.now().isoformat()
if try_report_to_output:
......
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