-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
cli: add allow-missing flag to commit command #10555
base: main
Are you sure you want to change the base?
cli: add allow-missing flag to commit command #10555
Conversation
@skshetry Could you review this please, especially |
@anunayasri It would be great to have a test for this. Also, could you confirm its semantics - that it keeps |
Looks like we don't have tests for Do you mind adding a test for this API? PTAL https://github.com/iterative/dvc/blob/main/tests/func/test_commit.py, which might help you how to write tests. If you have any questions, please feel free to ask here or in discord. |
@shcheklein There were no tests for cli commands, hence I had not added tests. It seems tests need to be added for the @skshetry Thanks. I will look into it. |
@anunayasri hey, are there any updates on this? do you need some help on this? (thanks for the PR btw!) |
Hi @shcheklein. Sorry. I was busy with office work and missed your comment. I have been chatting with @skshetry on discord DM. He helped me with my doubts. I am planning to work on the issue this week. |
Hi. I need help with writing the test case for
cc: @skshetry @shcheklein |
Hey @anunayasri. Sorry for the late response. I took a look at the implementation, and it looks like Without Additionally, it does not work with missing dependencies at this time. It's due to "run cache," which fails on missing dependencies, but it should be easy to work around.
Here's an example test case for pipelines: def test_allow_missing(tmp_dir, dvc):
tmp_dir.dvc_gen("foo", "foo")
dvc.run(
name="copy",
cmd=["cp foo foo_copy1", "cp foo foo_copy2"],
deps=["foo"],
outs=["foo_copy1", "foo_copy2"],
)
(tmp_dir / "foo_copy1").unlink()
(stage,) = dvc.commit("dvc.yaml", allow_missing=True)
outs = {out.def_path: out.hash_info.value for out in stage.outs}
assert outs == {
"foo_copy1": "acbd18db4cc2f85cedef654fccc4a4d8",
"foo_copy2": "acbd18db4cc2f85cedef654fccc4a4d8",
}
(tmp_dir / "foo_copy2").write_text("foobar", encoding="utf-8")
(stage,) = dvc.commit("dvc.yaml", allow_missing=True)
outs = {out.def_path: out.hash_info.value for out in stage.outs}
assert outs == {
"foo_copy1": "acbd18db4cc2f85cedef654fccc4a4d8",
"foo_copy2": "3858f62230ac3c915f300c664312c63f",
} Tip If you pass
|
Fixes #10524
β 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.
Thank you for the contribution - we'll try to review it as soon as possible. π