dvc icon indicating copy to clipboard operation
dvc copied to clipboard

dvc exp remove --keep

Open majidaldo opened this issue 1 year ago • 1 comments

I don't understand why one would want to remove the last n exps. Shouldn't this be in terms of --keep last n? The typical case is that one wants to just remove old exps.

majidaldo avatar Oct 18 '24 21:10 majidaldo

Makes sense to me to have this as an option.

shcheklein avatar Oct 19 '24 20:10 shcheklein

I don't understand why one would want to remove the last n exps. Shouldn't this be in terms of --keep last n? The typical case is that one wants to just remove old exps.

Related to this is that dvc exp list -A should be ordered according to the history. Right now the base commits are ordered alphabetically.

majidaldo avatar Oct 22 '24 18:10 majidaldo

Hi there !

Correct me if I'm wrong here (I'm just starting with this codebase).

The idea here could be, first sort the commits in chronological order in _get_n_commits (https://github.com/iterative/dvc/blob/fb24775bc09b19559eaae4f0ba23b1bb1ec569a3/dvc/scm.py#L182 then add an argument to to indicate the direction (before or after) in which we'd like to search the given number of commits, that parameter would drip down from https://github.com/iterative/dvc/blob/fb24775bc09b19559eaae4f0ba23b1bb1ec569a3/dvc/repo/experiments/remove.py#L66

and then add arguments to the exp remove cli command telling if we want to delete --num experiments either --before (new param) or --after (new param) the --rev commit

If I'm not too mistaken, I'm interested in giving it a shot as a first contribution to this repo ! Let me know 😊

rmic avatar Nov 22 '24 14:11 rmic

Hi there !

Correct me if I'm wrong here (I'm just starting with this codebase).

The idea here could be, first sort the commits in chronological order in _get_n_commits (

dvc/dvc/scm.py

Line 182 in fb24775

def _get_n_commits(scm: "Git", revs: list[str], num: int) -> list[str]: then add an argument to to indicate the direction (before or after) in which we'd like to search the given number of commits, that parameter would drip down from dvc/dvc/repo/experiments/remove.py

Line 66 in fb24775

exp_ref_dict = _resolve_exp_by_baseline(repo, rev, num, git_remote) and then add arguments to the exp remove cli command telling if we want to delete --num experiments either --before (new param) or --after (new param) the --rev commit

If I'm not too mistaken, I'm interested in giving it a shot as a first contribution to this repo ! Let me know 😊

ya overall that sounds right. thanks for tackling this.

re: chronological. i thought, more specifically, it would just be going up the commit tree but i understand it would be the same ordering ...typically.

majidaldo avatar Nov 22 '24 16:11 majidaldo

Fixing the order of the commits was not required for the --keep thing, which also explains why I finally did not go with the --before and --after params on the CLI as initially thought.

Yet, fixing the order of dvc exp list is something I might enjoy working next.

rmic avatar Nov 23 '24 22:11 rmic