Repository navigation
fix: include the store location in ObjectRef.full_path - #1648
Open
TheeCoderAhmed wants to merge 1 commit into
Open
TheeCoderAhmed wants to merge 1 commit into
TheeCoderAhmed wants to merge 1 commit into
Conversation
For s3, gcs and azure stores, full_path built <protocol>://<bucket>/<path> and left out the store's location, so it pointed to a path where the object is not when location is set. Use StorageBackend.get_url(), which builds the URL from the same _full_path the backend writes to. Fixes datajoint#1646
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1646.
For s3, gcs and azure stores,
ObjectRef.full_pathbuilt<protocol>://<bucket>/<path>by hand and left out the store'slocation. The backend stores objects at<bucket>/<location>/<path>(StorageBackend._full_path), so on a store with alocationthe returned URI points where the object isn't:ref.fs.exists(ref.full_path)isFalseeven thoughref.read()works.The cloud branches now return
self._backend.get_url(self.path). That builds the URL from_full_path, the same path the backend writes to andfsmapalready uses. Thefilebranch and the fallback for other protocols are unchanged, sofull_pathstill returns a plain filesystem path for local stores.Added
tests/unit/test_objectref.py. It covers s3 with and without alocation, gcs and azure, usingStorageBackendspecs that don't touch the network. The three cases with alocationfail onmaster(for examples3://bkt/_schema/...instead ofs3://bkt/proj/outbox/_schema/...) and pass with the change.tests/unit/test_storage_urls.pyandtests/unit/test_storage_adapter.pystill pass, andruff check/ruff format --checkare clean on the changed files.