Open gregstarr opened 8 months ago
I think dvc status -q --json
should be returning what you expect (json only) instead of only a return code. We have similar behavior in other commands like dvc data status -q --json
. @skshetry What do you think?
I saw that in the documentation but it seemed like that would result in no output at all
do not write anything to standard output. Exit with 0 if data and pipelines are up to date, otherwise 1.
You are right, @gregstarr, it outputs nothing today. I mean that we should change the behavior to work this way, since there's no reason to do dvc status -q --json
unless you want JSON output. We generally will still show JSON even with -q
in these scenarios, like in dvc data status -q --json
for example.
Personally, I think just --json should basically imply "-q --json" because I can't think of any use case for using --json but wanting extra output
Discussed with the team. There are two issues here:
-q
when --json
flag is used@gregstarr How are you using the command?
I have been using it like this:
dvc status --json <target> > status.json
I am using it to check the status of my pipelines and pass the json data to a minimal flask server for viewing.
Basically came as a result of this discussion post: https://discuss.dvc.org/t/ignore-files-in-stage-external-dependency-output/1889/2
I have a periodic task which clears out all the DS_Store files from my remote and checks the status of my pipelines.
@gregstarr dvc status -q --json
should now provide only the JSON output.
@skshetry Do you want to keep it open as a reminder to stream logs to stderr here?
Thanks for looking into this!
I was looking at this to contribute the fix. But the fix has already been merged. Request the maintainers to kindly close the issue. cc: @dberenbaum
@skshetry Do you want to keep it open as a reminder to stream logs to stderr here?
@anunayasri I think that part is left here
Bug Report
Description
When there are large files to hash which are not cached,
dvc status --json
will still print out the message, which makes the output not valid json. I believe the use case ofdvc status --json
is to be able to pipe the output to a file and easily read it with another program, so extra messages make this inconvenient.I accidentally erased the output I had but I think this is the message that is printed out: https://github.com/iterative/dvc-data/blob/300a3e072e5baba50f7ac5f91240891c0e30d030/src/dvc_data/hashfile/hash.py#L174
Reproduce
dvc status --json
for the first timeExpected
dvc status --json
only outputs valid jsonEnvironment information
Output of
dvc doctor
: