question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

exp apply: safeguard against unclean workspaces

See original GitHub issue

dvc exp apply will clear the workspace of untracked files and unstaged modifications. To prevent users losing work, it would be good to follow git’s convention of preventing overwriting of untracked/modified files unless the user gives explicit permission.

  • If dvc exp apply is executed on an unclean workspace, fail with a suggestion to stash work or specify a --force flag
  • dvc exp apply --force acts like the current command does.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
dberenbaumcommented, Dec 22, 2021

@pmrowla Forcibly overwriting conflicts is intended as explained here and in https://github.com/iterative/dvc.org/issues/2397, but it seems like experiments are overwriting everything in the workspace, even untracked files. This seems to conflict with https://github.com/iterative/dvc.org/issues/2397#issuecomment-822887190.

Example:

$ dvc stage add -n mystage echo foo
Creating 'dvc.yaml'
Adding stage 'mystage' in 'dvc.yaml'

To track the changes with git, run:

    git add dvc.yaml

To enable auto staging, run:

        dvc config core.autostage true
$ dvc exp run
Running stage 'mystage':
> echo foo
foo
Generating lock file 'dvc.lock'
Updating lock file 'dvc.lock'

To track the changes with git, run:

    git add dvc.lock dvc.yaml

To enable auto staging, run:

        dvc config core.autostage true

Reproduced experiment(s): exp-396c5
Experiment results have been applied to your workspace.

To promote an experiment to a Git branch run:

        dvc exp branch <exp> <branch>

$ touch newfile
$ dvc exp apply exp-396c5
Changes for experiment 'exp-396c5' have been applied to your current workspace.
$ git status
On branch main
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        dvc.lock
        dvc.yaml

nothing added to commit but untracked files present (use "git add" to track)
$ ls
dvc.lock dvc.yaml
2reactions
mattlbeckcommented, Nov 16, 2021

@pmrowla I hadn’t noticed the --no-force argument. On reflection, switching between experiments would necessitate use of a --force flag if it existed, and I guess that use-case is considered the most common.

I will monitor how I use exp apply for now, and whether I can easily encorporate --no-force into my workflow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Enhanced Workspaces to Manage Commerce Data
Now you can make inline edits on name and description in all workspaces. In the Product Workspace, you can select and show categories...
Read more >
How to Catalog Your Workspaces to Meet the Zero Trust ...
The first step in any security exercise is to discover and take inventory of what you need to protect. While most agencies that...
Read more >
Get started with WorkSpaces Quick Setup - AWS Documentation
In this tutorial, you learn how to provision a virtual, cloud-based Microsoft Windows, Amazon Linux, or Ubuntu Linux desktop, known as a WorkSpace, ......
Read more >
Onboard non-persistent virtual desktop infrastructure (VDI ...
Deploy the configuration package on virtual desktop infrastructure (VDI) device so that they are onboarded to Microsoft Defender for ...
Read more >
What is a clean desk policy? – Definition from TechTarget
A clean desk policy (CDP) is a corporate directive that specifies how employees should leave their work space when they leave the office....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found