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

Initial work towards re-running calibration job

parent 4e26f4df
No related branches found
No related tags found
1 merge request!544Reproducibility, step 1
import argparse
import json
import sys
from datetime import datetime
from pathlib import Path
from shutil import copytree
from .calibrate import Step, JobGroup, SlurmOptions
from .settings import temp_path
def main(argv=None):
ap = argparse.ArgumentParser()
ap.add_argument("from_dir", help="A directory containing exec_details.json")
ap.add_argument("--python", help="Path to Python executable to run notebooks")
ap.add_argument("--slurm-partition", help="Submit jobs in this Slurm partition")
ap.add_argument('--no-cluster-job', action="store_true",
help="Run notebooks here, not in cluster jobs")
args = ap.parse_args(argv)
run_uuid = f"t{datetime.now():%y%m%d_%H%M%S}"
working_dir = Path(temp_path, f'slurm_out_repeat_{run_uuid}')
copytree(args.from_dir, working_dir)
exec_details = json.loads((working_dir / 'exec_details.json').read_text('utf-8'))
job_group = JobGroup(
[Step.from_dict(d) for d in exec_details['steps']],
run_tmp_path=str(working_dir),
python=(args.python or sys.executable),
)
if args.no_cluster_job:
job_group.run_direct()
else:
job_group.submit_jobs(SlurmOptions(
partition=args.slurm_partition,
))
if __name__ == '__main__':
sys.exit(main())
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