Recreate environments on demand for xfel-calibrate-repeat
Description
This is another step towards reproducing offline calibration. We already have the machinery to re-run notebooks given a suitable Python environment, and we record the details of the Python environment when running calibration. This adds automatic environment creation, with caching using the env_cache package (written for this purpose).
You would use it something like this:
xfel-calibrate-repeat path/to/slurm_out_dir --env-cache ~/.calib-repeat-envs
This requires pyenv
on PATH (because this is also what caldeploy) uses. The first time you run it, it will ensure pyenv has the Python version recorded in calibration_metadata.yml
, create a virtualenv, and install packages from requirements.txt
. If you then repeat another run which needs an identical environment, it will reuse the environment.
The xfel-calibrate-repeat
command is also added as an alternative to python -m xfel_calibrate.repeat
.
How Has This Been Tested?
xfel-calibrate-repeat /gpfs/exfel/exp/MID/202201/p002834/usr/Reports/r60/slurm_out_MID_DET_AGIPD1M-1_correct_002834_r60_220413_235319 --env-cache repeat-envs --out-folder /gpfs/exfel/data/scratch/kluyvert/agipd-calib-2834-60-repro-w-env --slurm-mem 700
(See comments below)
Types of changes
- New feature (non-breaking change which adds functionality)
Checklist:
- My code follows the code style of this project.