Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo: Add ignore_revs. #8098

Closed
wants to merge 4 commits into from
Closed

repo: Add ignore_revs. #8098

wants to merge 4 commits into from

Conversation

daavoo
Copy link
Contributor

@daavoo daavoo commented Aug 5, 2022

Support to write a list of line-separated revisions to .dvc/ignore_revs.
If .dvc/ignore_revs exists, parse the revisions and skip them when using brancher.

Allows to skip broken commits in gc, pull, and push.

Closes #5037
Closes #5066
Closes #7585


Thank you for the contribution - we'll try to review it as soon as possible. 🙏

@daavoo daavoo added feature is a feature A: Repo Related to the internal Repo api labels Aug 5, 2022
@daavoo daavoo self-assigned this Aug 5, 2022
@daavoo daavoo force-pushed the ignore-revs branch 3 times, most recently from 947b624 to d6c90c6 Compare August 8, 2022 13:25
Support to write a list of line-separated revisions to `.dvc/ignore_revs`.
If `.dvc/ignore_revs` exists, parse the revisions and use them in `brancher` to skip.

Allows to skip broken commits in `gc`, `pull` and `push`.

Closes #5037
Closes #5066
Closes #7585
@daavoo daavoo marked this pull request as ready for review August 8, 2022 17:47
@daavoo daavoo requested a review from a team as a code owner August 8, 2022 17:47
@daavoo daavoo requested a review from pared August 8, 2022 17:47
@@ -381,6 +381,7 @@ def _ignore(self):
def brancher(self, *args, **kwargs):
from dvc.repo.brancher import brancher

kwargs["ignore_revs"] = self.ignore_revs
return brancher(self, *args, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

return brancher(self, *args, ignore_revs=self.ignore_revs, **kwargs)



@pytest.fixture
def broken_rev(tmp_dir, scm, dvc):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need a broken rev and the whole functional test. Instead, just check that if the config file made the desired revision disappear from iter_revs with a unit test is enough.

Copy link
Contributor Author

@daavoo daavoo Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disappear from iter_revs with a unit test is enough

I think it's not enough in this case.
If the underlying functionality of / gc / pull/ push` is changed (i.e. brancher usage is removed) there won't be any test indicating that the ignore_revs have stopped working for those commands.

return self.fs.path.join(self.dvc_dir, "ignore_revs")

@property
def ignore_revs(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should clarify what is ignore_revs file for an external repository. Do we need to read from the default branch or just the one we checked out? If we need to read from default branch, it might not be possible with shallow clones AFAICT.

Also what should happen if user asks for that particular revision (eg: plots diff <ignored_rev>)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should clarify what is ignore_revs file for an external repository.

Not sure I follow. Could you elaborate the use case?

Do we need to read from the default branch or just the one we checked out? If we need to read from default branch, it might not be possible with shallow clones AFAICT.

I believe we should read from the current revision. Treat ignore-revs as if it was part of config.

Also what should happen if user asks for that particular revision (eg: plots diff <ignored_rev>)?

We will skip the revision.
The use case is to use ignore_revs for broken revisions.
If a revision is broken, plots diff won't work (see #6150) so if we don't skip user will encounter the error?

Copy link
Contributor

@pared pared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So regarding our yesterday discussion:
I believe that this approach is better than trying to incorporate error_handler to usual workflow. Mainly because when using ignore_revs we are making conscious decision that we know some revisions will fail and we don't care. If we were to use error_handler, it would ignore errors without this conscious decision.

@dberenbaum
Copy link
Collaborator

So regarding our yesterday discussion: I believe that this approach is better than trying to incorporate error_handler to usual workflow. Mainly because when using ignore_revs we are making conscious decision that we know some revisions will fail and we don't care. If we were to use error_handler, it would ignore errors without this conscious decision.

Could we have a flag on how to handle failed revisions? I think having to write out a list of all failed revisions is cumbersome.

@pared
Copy link
Contributor

pared commented Oct 20, 2022

@dberenbaum then it seems the best we can do is some hybrid solution - use error_handler but provide different behaviors depending on some flag value:

  1. --errors ignore will just skip errored revisions
  2. --errors raise could stop execution and inform user what failed with what error
  3. --ignore_revs - manually provide revisions we know will fail

@dberenbaum
Copy link
Collaborator

That could work @pared. I have no opposition to this PR, but I don't think it solves all our error handling issues or makes a general error handler unnecessary.

@daavoo
Copy link
Contributor Author

daavoo commented Oct 20, 2022

Closing for now

@daavoo daavoo closed this Oct 20, 2022
@skshetry skshetry deleted the ignore-revs branch November 1, 2022 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: Repo Related to the internal Repo api feature is a feature
Projects
No open projects
Archived in project
6 participants