Skip to content
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

status: ignoring cache that is not in local cache nor in remote #4383

Closed
nik123 opened this issue Aug 12, 2020 · 3 comments
Closed

status: ignoring cache that is not in local cache nor in remote #4383

nik123 opened this issue Aug 12, 2020 · 3 comments

Comments

@nik123
Copy link
Contributor

@nik123 nik123 commented Aug 12, 2020

dvc status -c should probably exit with non-zero code if some files are not presented neither in cache, neither in remote.

It is possible that some files are not presented neither in local cache, neither in remote. In this case dvc status -c will print out warning and exit with zero code:

$dvc status -c
WARNING: Some of the cache files do not exist neither locally nor on remote. Missing cache files:
name: data.csv, md5: 746308829575e17c3331bbcb00c0898b
Data and pipelines are up to date.

It may happen if Alice executes dvc add data.csv, git add data.csv, git commit and git push but doesn't execute dvc push and Bob executes dvc status -c data.csv on another machine.

There should be a way in such case to exit with non-zero from dvc status command. It will allow to handle such errors in different scripts.

Context: https://discordapp.com/channels/485586884165107732/563406153334128681/743159360745898044

@efiop efiop changed the title Non-zero exit code for `dvc status -c` status: ignoring cache that is not in local cache nor in remote Aug 12, 2020
@efiop
Copy link
Member

@efiop efiop commented Aug 12, 2020

dvc status -c shouldn't exit with non-zero code by default, because missing cache is just part of the normal status report. It should exit with non-zero in case -q is specified (there is already logic for that), but the problem is that we ignore STATUS_MISSING in

if status_ in [cloud.STATUS_OK, cloud.STATUS_MISSING]:
. So the first step here is to just stop ignoring it there and include it into the report. This is pretty simple and just requires adjusting the lines I've linked above.

After that we might consider introducing a special option that will tell status to error-out if it is not up-to-date.

@nik123
Copy link
Contributor Author

@nik123 nik123 commented Aug 13, 2020

Thanks, @efiop ! I'll create PR with fix as soon as possible.

@jorgeorpinel
Copy link
Member

@jorgeorpinel jorgeorpinel commented Aug 23, 2020

Reopening per #4398 (comment), just a small detail:

If missing is now an expected status, the WARNING is probably no longer needed
I think I can achieve it by adding log_missing=True param into dvc.data_cloud.DataCloud.status...

@jorgeorpinel jorgeorpinel reopened this Aug 23, 2020
@nik123 nik123 mentioned this issue Aug 25, 2020
2 of 2 tasks complete
@efiop efiop closed this in #4470 Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.