ObjectRef.full_path leaves out the store's location for s3, gcs and azure stores
I maintainer di solito rispondono entro 4 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Inizia in objectref.py, da ObjectRef.full_path, poi confronta i relativi percorsi s3, gcs e azure con StorageBackend._full_path e il ramo file. La riproduzione mostra che le chiamate ref.fs.exists(ref.full_path) e ref.fs.open(ref.full_path) falliscono, mentre ref.read() e ref.fsmap funzionano. Il lavoro è concluso quando full_path include la posizione dello storage e queste chiamate al filesystem possono trovare e aprire l’oggetto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 197
- Fork
- 101
- Merge medio
- 3g 8h
- PR unite (30g)
- 28
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di datajoint/datajoint-python
-
len() of an expression with an empty primary key generates invalid SQLForse già presa @dimitri-yatsenko l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
datajoint/datajoint-python#1581 ·
I maintainer di solito rispondono entro 4 giorni
-
dj.Diagram theme: make the font configurableForse già presa @dimitri-yatsenko l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
datajoint/datajoint-python#1539 · 3 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
datajoint/datajoint-python#1644 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
bug
Difficoltà 4/5 1-2 giorni Idoneità per principianti 68/100
datajoint/datajoint-python#1641 ·
I maintainer di solito rispondono entro 4 giorni
-
A join on namesake secondary attributes raises the stale-`~lineage` error on a freshly declared schemaForse già presa @dimitri-yatsenko l’ha presa 6 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 82/100
datajoint/datajoint-python#1640 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di datajoint/datajoint-python
Issue simili
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadifficulty:2 enhancement good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
MakazhanAlpamys/Soup#2178 ·
I maintainer di solito rispondono entro 1 giorno
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLForse già presa @ninglinLiu l’ha presa oggi. Apertaarea:frontend backend:slang bug direction:input
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 13 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Kozea/Radicale#2301 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug ci good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno