Dvc: run: improve ERROR message for existing 'Dvcfile'

Created on 18 Jun 2019  路  7Comments  路  Source: iterative/dvc

Try

$ echo abc > file.txt
$ dvc run -d file.txt cat file.txt
# ^ creates Dvcfile
$ echo qwerty > qwerty.txt
$ dvc run -d qwerty.txt cat qwerty.txt
'Dvcfile' already exists. Do you wish to run the command and overwrite it? [y/n] n
ERROR: failed to run command - stage 'Dvcfile' already exists

My suggestion is to add a sentence to the error message above for this case: Use -f option to specify a different stage name (ending in '.dvc').

c1-quick-fix enhancement good first issue p3-nice-to-have ui

Most helpful comment

@jorgeorpinel

p.s. how hard would it be to use the base name of the first argument to the command as the fallback default stage name? In this case qwerty.dvc?

It is not hard at all, but the idea was that it should correspond either to the function or to the output. If we start using dependencies as well, it is easy to see how dvc add qwerty + dvc -d qwerty ... might get us into an even worse position.

All 7 comments

p.s. how hard would it be to use the base name of the first argument to the command as the fallback default stage name? In this case qwerty.dvc?

@jorgeorpinel

p.s. how hard would it be to use the base name of the first argument to the command as the fallback default stage name? In this case qwerty.dvc?

It is not hard at all, but the idea was that it should correspond either to the function or to the output. If we start using dependencies as well, it is easy to see how dvc add qwerty + dvc -d qwerty ... might get us into an even worse position.

Can I reserve this issue to be used for today's Devsprints?

@kurianbenoy sure!

Since the event is over, the issue is now open.

No longer relevant with the new dvc.yaml design. E.g. now it will fail with

ERROR: Stage 'mystage' already exists in 'dvc.yaml'. Use '--force' to overwrite.

Sounds good.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shcheklein picture shcheklein  路  3Comments

anotherbugmaster picture anotherbugmaster  路  3Comments

shcheklein picture shcheklein  路  3Comments

gregfriedland picture gregfriedland  路  3Comments

ghost picture ghost  路  3Comments