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').
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.
Most helpful comment
@jorgeorpinel
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.