-
Notifications
You must be signed in to change notification settings - Fork 49
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
python: KVSDir object should write to path it is initialized with #5308
Comments
Thanks for opening this @garlick ! Update: for future reference, my test cases are here: https://github.com/researchapps/test-kvs-commit |
Thanks for finding it! |
Looking through code history, this appears to be an oversight from the initial implementation in 2015. Surprised it took so long to find :-) Also no |
That's me, the bug finder!! 😆 🐛 🐞 Actually more like I'm really good at breaking things. 🔨 |
Workaround - works! researchapps/test-kvs-commit@9a8d1be Thanks for the help! This should work for our current needs- it works for both the case that the key exists and the case that it does not. |
note: looking through code, I think |
thinking about this a bit ... this change has the potential to break a ton of code, if people are using it. Which I don't know if people are. i.e.
before this created "foo.bar.a" and if we change it'll create "foo.bar.foo.bar.a". Perhaps we could ping a few code teams and see if they use KVSDir with a If a few teams are using it, then we perhaps should have a migration path to warn them of the change. Edit: ugh and likewise if people use the results from |
If the bug hasn't been caught for 8 years, do you think people are using it? |
I agree low probability. Two things made me pause.
Edit: also should mention Edit2: scratch the |
Problem: KVSDir can be passed an initial path when initialized. This path gives context to all reads. For example, if initialized with the path "foo", a later read of the key "bar" will actually read "foo.bar". While this works for reads, this does not work for writes. For example, if initialized with the path "foo", a later write of the key "bar" will write to the path "bar", not "foo.bar". Solution: When doing writes, ensure writes are written relative to the initial path. Fixes flux-framework#5308
Problem: The KVSDir initial path write issue (flux-framework#5308) was discovered via the job_kvs() function in the job/kvs.py module. There is no regression test for this issue. Add a new regression test t5308-kvsdir-initial-path.py.
Problem: The KVSDir initial path write issue (flux-framework#5308) was discovered via the job_kvs() function in the job/kvs.py module. There is no regression test for this issue. Add a new regression test t5308-kvsdir-initial-path.py.
Problem: KVSDir can be passed an initial path when initialized. This path gives context to all reads. For example, if initialized with the path "foo", a later read of the key "bar" will actually read "foo.bar". While this works for reads, this does not work for writes. For example, if initialized with the path "foo", a later write of the key "bar" will write to the path "bar", not "foo.bar". Solution: When doing writes, ensure writes are written relative to the initial path. Fixes flux-framework#5308
Problem: The KVSDir initial path write issue (flux-framework#5308) was discovered via the job_kvs() function in the job/kvs.py module. There is no regression test for this issue. Add a new regression test t5308-kvsdir-initial-path.py.
Problem: The KVSDir initial path write issue (flux-framework#5308) was discovered via the job_kvs() function in the job/kvs.py module. There is no regression test for this issue. Add a new regression test t5308-kvsdir-initial-path.py.
Problem: a KVSDir object acts like a dictionary for a KVS directory when reading from the KVS, but it discards its relative path and operates directly on the root when writing to the KVS.
For example, this program uses a KVSDir to print a key from a job directory and then update the same key:
The text was updated successfully, but these errors were encountered: