ObjectRef.full_path leaves out the store's location for s3, gcs and azure stores
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu tại objectref.py, ở ObjectRef.full_path, rồi so sánh các đường dẫn s3, gcs và azure với StorageBackend._full_path và nhánh file. Kết quả tái hiện cho thấy các lệnh gọi ref.fs.exists(ref.full_path) và ref.fs.open(ref.full_path) bị lỗi, trong khi ref.read() và ref.fsmap hoạt động. Hoàn tất khi full_path bao gồm vị trí lưu trữ và các lệnh gọi hệ thống tệp này có thể tìm và mở đối tượng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
On an s3, gcs or azure store with a location, ObjectRef.full_path points to a path where the object is not. ref.fs.exists(ref.full_path) returns False and ref.fs.open(ref.full_path) raises FileNotFoundError, although ref.read() returns the object.
The backend stores an object under <bucket>/<location>/<path> (StorageBackend._full_path). full_path builds s3://<bucket>/<path>, and the same for gs:// and az://, without the location. Its docstring says it includes the "bucket/location", and its file branch does add location.
ref.fsmap builds its root with _full_path, so it is not affected. On a store with an empty location, full_path is correct.
Reproduction
DataJoint 2.3.4 and master, MySQL 8.0, MinIO:
import pathlib
import tempfile
import datajoint as dj
dj.config.stores["outbox"] = {
"protocol": "s3", "endpoint": "localhost:9000", "bucket": "bkt", "location": "proj/outbox",
"access_key": "datajoint", "secret_key": "datajoint", "secure": False,
}
schema = dj.Schema("scratch_full_path")
@schema
class Result(dj.Manual):
definition = """
result_id : int32
---
data : <object@outbox>
"""
src = pathlib.Path(tempfile.mkdtemp()) / "result.txt"
src.write_text("hello")
Result.insert1({"result_id": 1, "data": str(src)})
ref = (Result & {"result_id": 1}).fetch1("data")
ref.read() # b'hello'
ref.full_path # 's3://bkt/_schema/scratch_full_path/result/result_id=1/data_....txt'
ref.fs.exists(ref.full_path) # False
ref.fs.exists(ref.fsmap.root) # True
ref.fs.open(ref.full_path) # FileNotFoundError
Workaround
Use ref.open(), ref.read() or ref.fsmap instead of ref.fs with ref.full_path.
Expected behavior
full_path includes the store's location, so ref.fs.open(ref.full_path) opens the object. For s3, gcs and azure it could return self._backend.get_url(self.path), which already prefixes the protocol to _full_path.
Where
ObjectRef.full_path in objectref.py.
- Ngôn ngữ chính
- Python
- Star
- 197
- Fork
- 101
- Merge trung bình
- 3 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 28
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của datajoint/datajoint-python
-
len() of an expression with an empty primary key generates invalid SQLCó thể đã có người làm @dimitri-yatsenko đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
datajoint/datajoint-python#1581 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
dj.Diagram theme: make the font configurableCó thể đã có người làm @dimitri-yatsenko đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
datajoint/datajoint-python#1539 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
datajoint/datajoint-python#1644 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 68/100
datajoint/datajoint-python#1641 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schemaCó thể đã có người làm @dimitri-yatsenko đã nhận 6 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 82/100
datajoint/datajoint-python#1640 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của datajoint/datajoint-python
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
WLAN-Pi/wlanpi-profiler#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Memory leak: the shared `validation_aborted_error` keeps every traceback it is raised throughCó thể đã có người làm @Fire162 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
graphql-python/graphql-core#287 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
roman-corgi/ctc-dip#160 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
render_findings.py reads and writes in the host's default encoding, so findings.html breaks on a cp1252 Windows hostCó thể đã có người làm @Aaqibhafeezkhan đã nhận hôm nay. Đang mởbug good first issue mentored python size: XS up-for-grabs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
dheerajjha/mcp-migrate#366 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày