-
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
Long strings dumped to dvc.lock contain extra space upon load #10668
Comments
Setting the width might change the existing |
Correct, although since currently there seems to be no work being done As for exisiting I'm pretty sure this change will not affect loading existing The first time you recreate |
Hi! |
Hey @janpawlowskiof, sorry for the delay in responding. We had a few P0 issues that took up my time. I'll try to review your PR this week. My preference here is to fix this upstream if possible, since setting width to But if there's no easy way to fix this, I'll merge your PR. |
With diff, I mean that if you have something like the following (from above example): fault_parameter_name: This is a prompt. This is a prompt. This is a prompt. This is
a prompt. This is a prompt. This is a prompt. will get changed into following: fault_parameter_name: This is a prompt. This is a prompt. This is a prompt. This is a prompt. This is a prompt. This is a prompt. |
That is correct, and I see that creating unexpected diffs in your lockfiles is less than optimal, because it might be slightly confusing. |
Bug Report
repro: long strings dumped to dvc.lock contain extra space upon load
Edit:
In PR, I replaced the
float("inf")
withsys.maxsize
as suggested in #9397 (comment)Description
The actual bug seems to be originating from
ruamel.yaml
, but we should mitigate it here.How it manifests:
I have this stage in
dvc.yaml
and this in
params.yaml
Despite not changing anything, dvc sees the step as changed, but then realizes the step was cached and loads it from cache.
Why it occurs:
When long lines are dumped to
dvc.lock
the line gets wrapped.The issue happens (only sometimes I think), when this wrap occurs after "\n" character.
When the yaml is then loaded it contains and additional space.
You can see this happen directly in the

ruamel.yaml
This can be worked around by adding this line, which makes it so that string is dumped in one line.
How it can be solved.
This can be probably solved be adding this line
here
dvc/dvc/utils/serialize/_yaml.py
Line 48 in 7d14acb
This solves my issue, and while I didn't do any real testing of this, I don't think this should cause any issues elsewhere.
Output of
dvc doctor
:This will hopefully be a one line fix, and I can add a PR for it today.
Best regards!
The text was updated successfully, but these errors were encountered: