pynbody / tangos

The Agile Numerical Galaxy Organisation System
BSD 3-Clause "New" or "Revised" License
19 stars 13 forks source link

Command-line tools for searching for and removing runs in bulk #169

Closed j-davies-astro closed 2 years ago

j-davies-astro commented 2 years ago

Several months ago we discussed adding some extra command-line tools for searching for tangos runs, and deleting them if desired. Here they are!

This modification renames the original "grep-runs" command to "grep-run-ids" to better suit its function. The "grep-runs" command now returns the full details of each of the runs matching the given string, which may include SQL wildcards such as "%" and "_".

Finally, there is a new "grep-remove" command, which will delete any runs matching the specified string, which is very useful for deleting whole simulations and large batches of changes to the database. The command first lists all the runs that will be deleted and always asks for confirmation from the user, as this command could potentially be very destructive.

j-davies-astro commented 2 years ago

I've just seen the new "delete halo properties" feature proposed by Andrew - I suppose this feature is a little degenerate than that. I think this feature is also useful, as "grep-remove" can also undo linking, adding trackers, and the addition of new simulations to the database.

apontzen commented 2 years ago

I've just seen the new "delete halo properties" feature proposed by Andrew - I suppose this feature is a little degenerate than that. I think this feature is also useful, as "grep-remove" can also undo linking, adding trackers, and the addition of new simulations to the database.

I agree it's fine to have both facilities even if there is a little overlap in possible use cases

j-davies-astro commented 2 years ago

I wrapped the run removal code into a function and did some reordering of the functions so that all the "run removal" code was in one place.