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

Use Scope for VCS #445

Merged
merged 22 commits into from
Sep 7, 2021
Merged

Use Scope for VCS #445

merged 22 commits into from
Sep 7, 2021

Conversation

zhiltsov-max
Copy link
Contributor

@zhiltsov-max zhiltsov-max commented Sep 3, 2021

Summary

Depends on #444

Introduces resource management for the Project class. Fixes file removal issues on Windows. Improves test performance by disabling DVC analytics sending.

How to test

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

Maxim Zhiltsov and others added 21 commits September 2, 2021 18:19
…rned (#443)

* lazy_image: fix cache collisions leading to unrelated data being returned

Currently, the key used to look up the cached image is based on a hash of
a tuple containing `id(self)`, `path`, and `loader`. This means there are two
situations in which a `lazy_image` can look up the wrong data:

* If there previously existed another `lazy_image` object whose `self` and
  `loader` had the same object IDs as the current `lazy_image`'s `self` and
  `loader`. This is possible, because deleted objects' IDs can be reused.

* If a hash collision occurs between the current `lazy_image`'s tuple and
  some other's.

Fix it by using a weak reference to `self` as the key instead. Different weak
references will only compare equal if they point to the same object.

This will only work correctly if the loader and path of a `lazy_image` are
not modified after creation. I don't think there are any use cases for
modifying them (and there are no instances of that happening in the codebase),
so it shouldn't be an issue. To reduce the temptation of client code to modify
these fields, mark them as private.

Modifying the `cache` field should not cause issues, but just in case, make it
private as well.

* Add a changelog entry for the lazy_image cache collision fix
* Replace rollback with scope

* Add scope_add() function

* Update tests

* Replace rollback uses

* Update changelog
@zhiltsov-max zhiltsov-max changed the title [WIP] [Dependent] Use Scope for VCS Use Scope for VCS Sep 7, 2021
@zhiltsov-max zhiltsov-max merged commit 8f78e79 into zm/vcs-simple-exp Sep 7, 2021
@zhiltsov-max zhiltsov-max deleted the zm/test-scoped-with-vcs branch September 7, 2021 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant