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 apply: enable forcing (unsaved files in the workspace) #9992

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented Oct 3, 2023

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™


Closes #9991

Docs change iterative/dvc.org#4895

Comments inline.

@@ -33,10 +25,11 @@ def add_parser(experiments_subparsers, parent_parser):
formatter_class=argparse.RawDescriptionHelpFormatter,
)
experiments_apply_parser.add_argument(
Copy link
Member Author

Choose a reason for hiding this comment

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

[Q] Is it ok to deprecate this now? It has not been working for a while.

Copy link
Collaborator

@dberenbaum dberenbaum Oct 4, 2023

Choose a reason for hiding this comment

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

I thought we were forcing by default? cc @pmrowla

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

All modified lines are covered by tests βœ…

Files Coverage Ξ”
dvc/commands/experiments/apply.py 100.00% <100.00%> (+10.52%) ⬆️
tests/unit/command/test_experiments.py 100.00% <100.00%> (ΓΈ)

πŸ“’ Thoughts on this report? Let us know!.

assert cli_args.func == CmdExperimentsApply

cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.experiments.apply.apply", return_value={})
Copy link
Member Author

Choose a reason for hiding this comment

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

[C] Really I want to call dvc.repo.checkout.checkout here but the test dies with an error. Any pointers?

@mattseddon mattseddon changed the title exp apply: Enable forcing exp apply (unsaved files in the workspace) exp apply: Enable forcing (unsaved files in the workspace) Oct 3, 2023
@mattseddon mattseddon marked this pull request as ready for review October 3, 2023 04:54
@mattseddon mattseddon changed the title exp apply: Enable forcing (unsaved files in the workspace) exp apply: enable forcing (unsaved files in the workspace) Oct 3, 2023
@dberenbaum dberenbaum enabled auto-merge (rebase) October 4, 2023 19:45
@dberenbaum dberenbaum merged commit 3661b89 into iterative:main Oct 4, 2023
21 checks passed
@dberenbaum
Copy link
Collaborator

Sorry, I didn't mean to enable auto-merge here before having @pmrowla review.

@dberenbaum
Copy link
Collaborator

@pmrowla Please do take a look at this. I can't recall if this is expected behavior, an oversight in the CLI, or if there is a bug.

"\tgit stash apply refs/exps/apply/stash\n"
)
self.repo.experiments.apply(self.args.experiment)
self.repo.experiments.apply(self.args.experiment, force=self.args.force)
Copy link
Contributor

@pmrowla pmrowla Oct 26, 2023

Choose a reason for hiding this comment

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

Setting force here does not do anything, the underlying experiments.apply behavior was changed to always do the force apply. Since the DVC checkout now needs force to allow removing untracked files, that flag should just always be set internally by experiments.apply.

Basically, the intent is to not have a CLI level option for exp apply --force/--no-force at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

exp apply: unable to apply an experiment when there are unsaved changes in the workspace
3 participants