ontometer_corpus.store.remote¶
Remotes that mirror the object store: a directory, or a Hugging Face dataset.
A remote holds files at store-relative paths (objects/<hh>/<hash><ext>,
cache/<kind>/v<N>/<hh>/<hash>.parquet). It is add-only: :meth:Remote.put
skips a path that already exists and nothing here deletes. Object paths are
content hashes, so skipping an existing path never loses data.
Attributes¶
T = TypeVar('T')
module-attribute
¶
STORE_REMOTE = 'hf://datasets/growgraph/ontometer-store'
module-attribute
¶
CACHE_REMOTE = 'hf://datasets/growgraph/ontometer-cache'
module-attribute
¶
CORPUS_REMOTE = 'hf://datasets/growgraph/ontometer-corpus'
module-attribute
¶
HF_COMMIT_OPS = 100
module-attribute
¶
HF_DOWNLOAD_WORKERS = 8
module-attribute
¶
Classes¶
RemoteFile
dataclass
¶
A file on a remote; sha256 is set when the remote records one.
Source code in ontometer_corpus/store/remote.py
Remote
¶
Bases: Protocol
What the store operations need from a remote.
Source code in ontometer_corpus/store/remote.py
DirRemote
¶
A remote that is a directory with the store's layout (file://…).
Serves as the offline hand-over, an rsync target and the test double. A tag
is a listing snapshot under tags/<name>.tsv.
Source code in ontometer_corpus/store/remote.py
Attributes¶
root = Path(root)
instance-attribute
¶
Methods:¶
__init__(root)
¶
list(prefix, revision=None)
¶
Source code in ontometer_corpus/store/remote.py
fetch(rel_paths, staging, revision=None)
¶
Source code in ontometer_corpus/store/remote.py
put(files, message)
¶
Source code in ontometer_corpus/store/remote.py
write(rel_path, data, message)
¶
Source code in ontometer_corpus/store/remote.py
tag(name)
¶
Source code in ontometer_corpus/store/remote.py
HfRemote
¶
A Hugging Face dataset repository (hf://datasets/<org>/<name>).
Credentials come from the huggingface_hub login. Downloads go to the
caller's staging directory, never to the hub cache, so the store is the only
full copy on disk.
Source code in ontometer_corpus/store/remote.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
Attributes¶
repo_id = repo_id
instance-attribute
¶
api = api
instance-attribute
¶
Methods:¶
__init__(repo_id, *, api=None)
¶
list(prefix, revision=None)
¶
Source code in ontometer_corpus/store/remote.py
fetch(rel_paths, staging, revision=None)
¶
Source code in ontometer_corpus/store/remote.py
put(files, message)
¶
Source code in ontometer_corpus/store/remote.py
write(rel_path, data, message)
¶
Source code in ontometer_corpus/store/remote.py
tag(name)
¶
Functions:¶
open_remote(url, *, api=None)
¶
A remote from its URL: file:///path or hf://datasets/<org>/<name>.
Raises:
| Type | Description |
|---|---|
ValueError
|
unknown scheme. |