camall3n/onager

Add `history` subcommand

camall3n opened this issue · 0 comments

Proposal:
New onager history command

Description:
Output a table consisting of previous calls to prelaunch/launch. Useful for documenting what was run and what settings things used.

Sample output:

  id  date        time             command
----  ----------  ---------------  -----------------------------------------------------------------------------------------
   0  2022.12.15  00:33:47.449593  prelaunch +jobname exp_01 +command myscript --name foo +arg --seed 1 2 3 --lr 0.003 0.001
   1  2022.12.15  00:33:54.051139  launch --jobname exp_01 --backend local --duration 00:03:00 --cpus 2 --mem 10
   2  2022.12.15  00:34:18.636573  launch --jobname exp_01 --backend local --duration 00:30:00 --cpus 4 --mem 8 --dry-run
   3  2022.12.15  00:34:43.077715  prelaunch +jobname exp_02 +command myscript --name foo +arg --seed 4 5 6 --lr 0.003 0.001
   4  2022.12.15  00:34:56.033614  launch --jobname exp_02 --backend local --duration 00:30:00 --cpus 4 --mem 8

Args:

--launch           Filter for displaying launch commands (default is all commands)
--prelaunch        Filter for displaying prelaunch commands (default is all commands)
--no-dry-run       Hide dry-run entries from the output
-n [N]             Limit output to the most recent N entries
--since [DATE]     Limit output to only the entries since DATE

Implementation:
When prelaunch/launch are called, the command details are always saved to .onager/history_index.csv. Then onager history retrieves the details from this file when needed.