dynamics-of-stellar-systems / dynamite

dynamics, age and metallicity indicators tracing evolution
MIT License
10 stars 1 forks source link

Save disk space by cleaning up decompressed files independently from legacy script succeeding or not #382

Closed maindlt closed 2 months ago

maindlt commented 2 months ago

Save disk space by cleaning up decompressed files independently from legacy Fortran code succeeding or crashing.

Safer removal of nn_orbmat.out: check for existing file before deleting.

Suggestion for testing:

  1. Provoke an error in LegacyWeightSolver.solve(), right after executing the shell script (this simulates a script error). For example, this can be done in weight_solvers.py by changing line 316 from if not p.stdout.decode("UTF-8"): to if not p.stdout.decode("UTF-8") and False:.
  2. Run any example using the LegacyWeightSolver.
  3. Verify that after DYNAMITE crashes, there are no surviving orblib_*.dat files in any of the datfil/ folders (those would be the uncompressed files).
  4. Optional: in line 314, change os.remove(f_name) to pass and re-run. The orblib_*.dat files should still be there in the datfil/ folder(s) after DYNAMITE crashes.

So far, tested successfully with test_nnls.py (after changing to the LegacyWeightSolver in its config file).

prashjet commented 2 months ago

I ran the suggested test with test_nnls and all orblib_*.dat files are removed.

maindlt commented 2 months ago

Many thanks, Prash! Will merge and delete branch :-)