Handle case in DVC where no commands are appropriate

If only have commands with no deps or outputs (admittedly unlikely), you
get a weird error about the dvc file not existing. This gives explicit
output instead.
This commit is contained in:
Paul O'Leary McCann 2022-09-12 18:24:55 +09:00
parent b5a0518b06
commit e2265f0864

View File

@ -138,6 +138,16 @@ def update_dvc_config(
dvc_cmd.append("--always-changed") dvc_cmd.append("--always-changed")
full_cmd = [*dvc_cmd, *deps_cmd, *outputs_cmd, *outputs_nc_cmd, *project_cmd] full_cmd = [*dvc_cmd, *deps_cmd, *outputs_cmd, *outputs_nc_cmd, *project_cmd]
dvc_commands.append(full_cmd) dvc_commands.append(full_cmd)
if not dvc_commands:
# If we don't check for this, then there will be an error when reading the
# config, since DVC wouldn't create it.
msg.fail(
"No usable commands for DVC found. This can happen if none of your "
"commands have dependencies or outputs.",
exits=1,
)
with working_dir(path): with working_dir(path):
for c in dvc_commands: for c in dvc_commands:
dvc_command = ["dvc", *c] dvc_command = ["dvc", *c]