ObjectRef.full_path leaves out the store's location for s3, gcs and azure stores
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
objectref.py の ObjectRef.full_path から始め、s3、gcs、azure の各パスを StorageBackend._full_path および file 分岐と比較します。再現結果では、ref.fs.exists(ref.full_path) と ref.fs.open(ref.full_path) の呼び出しは失敗しますが、ref.read() と ref.fsmap は機能します。full_path にストアの場所が含まれ、これらのファイルシステム呼び出しでオブジェクトを見つけて開けるようになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 197
- フォーク
- 101
- 平均マージ
- 3日 8時間
- マージ済み PR(30日)
- 28
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
datajoint/datajoint-python のほかの issue
-
len() of an expression with an empty primary key generates invalid SQL対応中かも @dimitri-yatsenko が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
datajoint/datajoint-python#1581 ·
メンテナーはふだん 4 日以内に返信
-
dj.Diagram theme: make the font configurable対応中かも @dimitri-yatsenko が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
datajoint/datajoint-python#1539 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
datajoint/datajoint-python#1644 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
bug
難易度 4/5 1〜2日 初心者へのやさしさ 68/100
datajoint/datajoint-python#1641 ·
メンテナーはふだん 4 日以内に返信
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schema対応中かも @dimitri-yatsenko が 9 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 82/100
datajoint/datajoint-python#1640 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
datajoint/datajoint-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
scikit-learn-contrib/category_encoders#553 ·
メンテナーはふだん 1 日以内に返信
-
tests/strategies_test.py:174 goes uncovered on about 1 run in 100, failing the coverage ratchetオープンflaky-watch
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
btclib-org/btclib#2839 ·
メンテナーはふだん 1 日以内に返信
-
BarrelList constructor drops false-valued iterable contents対応中かも @Gambit-Checkmate が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 19 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
vllm-project/vllm#63863 ·
メンテナーはふだん 1 日以内に返信