As part of JOSS Review openjournals/joss-reviews#2554
The following test command was run to try out using different models not included by default.
If the download gets interrupted in the middle, then when trying to run the same command again later on, the model grid is assumed to already exist and it is unable to actually proceed.
Input (2 times, first time to interrupt download):
desk fit --source='/anaconda3/envs/desk_rev_pip/lib/python3.8/site-packages/desk/put_target_data_here/' --distance=30 --grid='Crystalline-20-bb' --multiprocessing=True
Output:
You already have the grid!
Traceback (most recent call last):
File "/anaconda3/envs/desk_rev_pip/bin/desk", line 8, in
sys.exit(main())
File "/anaconda3/envs/desk_rev_pip/lib/python3.8/site-packages/desk/main.py", line 33, in main
func(**funcargs)
File "/anaconda3/envs/desk_rev_pip/lib/python3.8/site-packages/desk/console_commands.py", line 121, in fit
grid_dusty, grid_outputs = get_models.get_model_grid(grid, testing)
File "/anaconda3/envs/desk_rev_pip/lib/python3.8/site-packages/desk/set_up/get_models.py", line 187, in get_model_grid
grid_dusty = read_hdf5(models_file_name, testing)
File "/anaconda3/envs/desk_rev_pip/lib/python3.8/site-packages/desk/set_up/get_models.py", line 29, in read_hdf5
with h5py.File(filename, "r") as f:
File "/anaconda3/envs/desk_rev_pip/lib/python3.8/site-packages/h5py/_hl/files.py", line 406, in init
fid = make_fid(name, mode, userblock_size,
File "/anaconda3/envs/desk_rev_pip/lib/python3.8/site-packages/h5py/_hl/files.py", line 173, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 88, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 5513216, sblock->base_addr = 0, stored_eof = 14722048)
Suggested Change:
Add in a way to check that the existing model grid is valid/complete. Can be done perhaps with try statement checking for an OSError when loading the model. If the error is raised, then automatically re-download the grid.
There is probably a more artful/clean way to implement this fix as well.
As part of JOSS Review openjournals/joss-reviews#2554
The following test command was run to try out using different models not included by default. If the download gets interrupted in the middle, then when trying to run the same command again later on, the model grid is assumed to already exist and it is unable to actually proceed.
Input (2 times, first time to interrupt download):
desk fit --source='/anaconda3/envs/desk_rev_pip/lib/python3.8/site-packages/desk/put_target_data_here/' --distance=30 --grid='Crystalline-20-bb' --multiprocessing=True
Output:
Suggested Change: Add in a way to check that the existing model grid is valid/complete. Can be done perhaps with try statement checking for an OSError when loading the model. If the error is raised, then automatically re-download the grid. There is probably a more artful/clean way to implement this fix as well.