Skip to content

Implement removing of the stage #3881

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

Merged
merged 1 commit into from
May 31, 2020
Merged

Conversation

skshetry
Copy link
Collaborator

@skshetry skshetry commented May 27, 2020

This PR adds support for removing stage entry for pipeline files and allows overwriting stage entry during run.

Backward Incompatible changes:

  1. Changes --overwrite-dvcfile flag to --overwrite so that it makes sense for both kind of files.
  2. Removes --outs flag from dvc remove.
  3. run will always raise an exception if there already exists a stage, previously it'd prompt to overwrite.
  • ❗ I have followed the Contributing to DVC checklist.

  • 📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. If the CLI API is changed, I have updated tab completion scripts.
    PR will come shortly.

  • ❌ I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)

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

Closes #3317

@skshetry skshetry added this to the 1.0 milestone May 27, 2020
@skshetry skshetry self-assigned this May 27, 2020
@skshetry skshetry changed the title [WIP] Implement removing of the stage Implement removing of the stage May 28, 2020
@skshetry skshetry marked this pull request as ready for review May 28, 2020 11:36
@skshetry skshetry requested review from efiop, pared and pmrowla and removed request for efiop and pared May 28, 2020 11:36
@skshetry skshetry mentioned this pull request May 29, 2020
This should allow us to be able to remove a stage from a dvcfile,
(if it's a single stage file, it removes it), and make us able to
delete the overwrite the stage on run as well.

This commit:
* changes `run` `--overwrite-dvcfile` flag to `--overwrite`
* removes prompt in `run` for overwrite and fails hard
* changes `remove`: now it by default removes stage entry and unprotect outs
* `remove` has `--outs` to remove outputs instead of unprotecting them
@skshetry skshetry requested a review from efiop May 29, 2020 08:38
@@ -165,6 +165,9 @@ def remove_with_prompt(self, force=False):

self.remove()

def remove_stage(self, stage):
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't FileMixin contain this method? It feels a little bit off to accept stage here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@pared, how about:

Suggested change
def remove_stage(self, stage):
def remove_stage(self, stage_name):

@efiop efiop merged commit edfa174 into iterative:master May 31, 2020
@skshetry skshetry deleted the stage_remove branch June 10, 2020 11:40
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.

remove: change default behaviour to --purge, port back patch from 1.0 branch
3 participants