cml icon indicating copy to clipboard operation
cml copied to clipboard

ci: --fetch-depth

Open casperdcl opened this issue 3 years ago • 7 comments

Backtracking on not doing this earlier - cml ci --fetch-depth=<int> is a good idea

  • depth=0 could be an alias for --unshallow
  • could thus deprecate (hide) --unshallow
  • things like depth=2 is useful for e.g. dvc metrics diff HEAD~1 CC @shcheklein @dberenbaum @pmrowla
  • cml ci --fetch-depth=2 is more trustworthy than manually running git fetch --depth=2 because the latter may not work as expected (?) if the repo was checked out weirdly (vis actions/checkout@v3 breaking changes)
  • cml ci --fetch-depth=2 is cross-CI compatible unlike actions/checkout.with.fetch-depth: 2

casperdcl avatar Apr 18 '22 16:04 casperdcl

btw just to confirm @dberenbaum does git fetch --depth=2 also obtain DVC exp's hidden reflog?

casperdcl avatar Apr 19 '22 10:04 casperdcl

Hm, good question. I think not since those refs will likely not be part of the linear history of the branch being fetched (plus it seems a bit DVC-specific). cc @pmrowla

dberenbaum avatar Apr 19 '22 11:04 dberenbaum

btw just to confirm @dberenbaum does git fetch --depth=2 also obtain DVC exp's hidden reflog?

No, this just sets the depth of whatever refs have already been cloned/fetched to 2. So by default it will only include git branches and tags (and if actions/checkout uses --single-branch it would only include the PR branch)

pmrowla avatar Apr 19 '22 11:04 pmrowla

ok so I assume only git fetch --unshallow will work? Is there no other way? What if the repo is massive and a full unshallow is undesirable?

casperdcl avatar Apr 21 '22 14:04 casperdcl

The experiment refs aren't needed, so usually fetch depth of 2 or so on the cloned branch will be enough. They are needed to merge the head and the experiment changed afaik.

dberenbaum avatar Apr 21 '22 16:04 dberenbaum

ok so I assume only git fetch --unshallow will work? Is there no other way? What if the repo is massive and a full unshallow is undesirable?

This won't fetch exp refs either, git commands only fetch branches/tags by default. You have to either be specifying the full exp refs with git fetch <options> refs/exps/... or using the dvc exp pull commands

pmrowla avatar Apr 22 '22 02:04 pmrowla

To be clear, fetching exp refs is unnecessary for many exp operations, like exp run. Having fetch depth is still useful for exp run.

dberenbaum avatar Apr 22 '22 12:04 dberenbaum

Hello! I've been curious about CML for some time, and Hacktoberfest seems like a good opportunity to dive in. Can I take a stab at this issue?

Based on a quick look, I think this would involve modifying similar code as in https://github.com/iterative/cml/pull/957/files. @casperdcl Just to confirm, based on your description, should the fix deprecate --unshallow at the same time?

deepyaman avatar Oct 03 '22 14:10 deepyaman

thanks @deepyaman! Yes feel free to have a go. --unshallow can be soft-deprecated using .hidden :)

casperdcl avatar Oct 03 '22 14:10 casperdcl

Sorry for the delay. This is still very much on my list of things to do; got busy, but I hope to have a PR by later this week.

deepyaman avatar Oct 12 '22 07:10 deepyaman

no problem, looking forward to a PR @deepyaman :)

casperdcl avatar Oct 14 '22 15:10 casperdcl

Are there contribution guidelines? I came across https://cml.dev/doc/contributing/core, but I'd already done npm install and tried npm test, but it gives a lot of issues around tokens not being found, etc. I also assume the docs should require pip install tensorboard (I see it in the CI config, and am getting some related errors), but haven't gotten a chance to set that up yet.

~Alternatively, I think I can result any errors if the CI is allowed to run.~ I see it ran.

deepyaman avatar Oct 19 '22 15:10 deepyaman

Ah don't worry about testing locally - a lot of functionality needs actual CI to test effectively.

Don't worry if PR tests also fail, we can fix them :)

casperdcl avatar Oct 24 '22 23:10 casperdcl