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

exp: ignore workspace errors during push/pull #10128

Merged
merged 5 commits into from
Dec 7, 2023
Merged

exp: ignore workspace errors during push/pull #10128

merged 5 commits into from
Dec 7, 2023

Conversation

dberenbaum
Copy link
Collaborator

Fixes #9768. Even for operations that don't use the workspace, like dvc exp push, dvc was logging errors if the workspace state was invalid, making it look like the command failed. This PR suppresses those errors if the workspace was not one of the included revs.

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7c61463) 90.66% compared to head (185d9bb) 90.40%.
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10128      +/-   ##
==========================================
- Coverage   90.66%   90.40%   -0.27%     
==========================================
  Files         488      494       +6     
  Lines       37425    37649     +224     
  Branches     5442     5481      +39     
==========================================
+ Hits        33932    34037     +105     
- Misses       2857     2951      +94     
- Partials      636      661      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 83 to 87
if rev == "workspace" and rev not in revs:
continue
if onerror:
onerror(rev, None, exc)
collection_exc = exc
Copy link
Member

@skshetry skshetry Dec 3, 2023

Choose a reason for hiding this comment

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

Looking at the code, it seems we never raise error, unless there are no indexes.
So, it seems dvc exp push will only fail if both of the workspace and experiment ref failed to get collected, or if we have no experiment to push, but only the workspace that has failed to get collected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If there is an error only in the workspace, it will not fail, but it will loudly log an error message that looks like something went wrong. For example:

$ dvc exp push origin
ERROR: failed to collect 'workspace' - failed to parse 'stages.params_test.cmd' in 'dvc.yaml': Could not find 'params'
Pushed experiment rival-knap to Git remote 'origin'.
1 file uploaded

See also the test below.

Copy link
Member

Choose a reason for hiding this comment

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

That means we should not use logging.exception in this case (which should only be used before raising an exception), and the error message should just suggest that it was skipped due to the failure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That means we should not use logging.exception in this case

Okay, I pushed another commit where I changed the logging to a warning. However, I am still skipping it for the workspace in the case where other revs were passed that don't include the workspace. It seems misleading to show warnings about the workspace rev in these cases since the workspace is irrelevant (for example, when pushing or pulling experiments).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TBH I think the "right" solution here is not to fetch the workspace at all. It's wasteful in this case, but I was trying to limit the changes.

Copy link
Member

Choose a reason for hiding this comment

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

I looked where we are calling fetch, and I am fine with this PR, but I have to note we are changing behaviour here (i.e on --all-commits we are skipping workspace).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It also uses this method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, I see that's also documented in https://dvc.org/doc/command-reference/push#-A, so I'll limit to dvc exp push/pull for now.

Copy link
Member

Choose a reason for hiding this comment

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

It also uses this method.

My apologies, _collect_indexes in fetch keeps on confusing me. Doesn't make any sense.
Especially with a small GitHhub diffview. 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, limited it to exp push/pull

@skshetry skshetry requested a review from efiop December 5, 2023 15:36
@skshetry
Copy link
Member

skshetry commented Dec 5, 2023

Code changes look good to me. cc'ing @efiop to review once.

@efiop efiop merged commit 7c898cf into main Dec 7, 2023
19 of 21 checks passed
@efiop efiop deleted the push-invalid-ws branch December 7, 2023 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dvc exp push: pushing/pulling cache fails if params.yaml not in workspace
3 participants