hypercache-io 0.9.1__tar.gz → 0.9.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/PKG-INFO +1 -1
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/__init__.py +1 -1
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/client.py +5 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/datapath.py +10 -1
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache_io.egg-info/PKG-INFO +1 -1
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/pyproject.toml +1 -1
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/tests/test_robustness.py +41 -3
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/README.md +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/fsspec_fs.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/integrations/__init__.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/integrations/dcp.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/integrations/safetensors_loader.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/kv_store.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache/pipeline.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache_io.egg-info/SOURCES.txt +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache_io.egg-info/dependency_links.txt +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache_io.egg-info/entry_points.txt +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache_io.egg-info/requires.txt +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/hypercache_io.egg-info/top_level.txt +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/setup.cfg +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/tests/test_client.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/tests/test_fsspec.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/tests/test_integrations_and_kv.py +0 -0
- {hypercache_io-0.9.1 → hypercache_io-0.9.3}/tests/test_pipelined_and_numa.py +0 -0
|
@@ -154,6 +154,11 @@ class HyperCacheClient:
|
|
|
154
154
|
self._sock = sock
|
|
155
155
|
self._rbuf = bytearray()
|
|
156
156
|
return sock
|
|
157
|
+
except PermissionError as e:
|
|
158
|
+
raise ConnectionError(
|
|
159
|
+
f"Permission denied on HyperCache socket {self.socket_path} (uid {os.getuid()}). "
|
|
160
|
+
"Set client_gid in the daemon configuration and run this process with that group."
|
|
161
|
+
) from e
|
|
157
162
|
except Exception as e:
|
|
158
163
|
logger.debug(f"Failed to connect to HyperCache daemon at {self.socket_path}: {e}")
|
|
159
164
|
raise ConnectionError(
|
|
@@ -535,7 +535,16 @@ class DirectBlockWriter:
|
|
|
535
535
|
return self._fd_cache[device_path]
|
|
536
536
|
|
|
537
537
|
def _write_ram_chunk(self, target_path: str, chunk_data: bytes) -> None:
|
|
538
|
-
|
|
538
|
+
# The daemon creates staged RAM chunk files. Never create the directory here: if it is
|
|
539
|
+
# missing, this process does not share /dev/shm with the daemon, and writing a private
|
|
540
|
+
# copy would make the checkpoint silently disappear.
|
|
541
|
+
if not os.path.isdir(os.path.dirname(os.path.abspath(target_path))):
|
|
542
|
+
raise FileNotFoundError(
|
|
543
|
+
f"RAM chunk directory for {target_path} does not exist in this process. It does not "
|
|
544
|
+
"share /dev/shm with the HyperCache daemon (run the daemon container with --ipc=host "
|
|
545
|
+
"or mount the host's /dev/shm into both)."
|
|
546
|
+
)
|
|
547
|
+
# "wb" still creates the file for daemons older than 0.9.2, which did not pre-create it
|
|
539
548
|
with open(target_path, "wb") as f:
|
|
540
549
|
f.write(chunk_data)
|
|
541
550
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "hypercache-io"
|
|
7
|
-
version = "0.9.
|
|
7
|
+
version = "0.9.3"
|
|
8
8
|
description = "HyperCache: Host-Local NVMe Caching and Zero-Copy Direct Block DMA / GPUDirect Storage Acceleration for AI Workloads"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Apache-2.0" }
|
|
@@ -5,6 +5,7 @@ bounce buffers, tier-based SHM detection, and opt-in CRC32 verification.
|
|
|
5
5
|
|
|
6
6
|
import json
|
|
7
7
|
import os
|
|
8
|
+
import shutil
|
|
8
9
|
import socket
|
|
9
10
|
import sys
|
|
10
11
|
import tempfile
|
|
@@ -19,6 +20,7 @@ from hypercache.datapath import (
|
|
|
19
20
|
ChecksumMismatchError,
|
|
20
21
|
ChunkLocation,
|
|
21
22
|
DirectBlockReader,
|
|
23
|
+
DirectBlockWriter,
|
|
22
24
|
get_data_reader,
|
|
23
25
|
)
|
|
24
26
|
|
|
@@ -187,6 +189,20 @@ class TestClientConcurrencyAndFraming(unittest.TestCase):
|
|
|
187
189
|
client.locate("hypercache://x/1", auto_ingest=False)
|
|
188
190
|
self.assertFalse(client.ping())
|
|
189
191
|
|
|
192
|
+
@unittest.skipIf(os.geteuid() == 0, "root bypasses socket permissions")
|
|
193
|
+
def test_socket_permission_error_names_client_gid(self):
|
|
194
|
+
server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
195
|
+
server.bind(self.path)
|
|
196
|
+
server.listen(1)
|
|
197
|
+
try:
|
|
198
|
+
os.chmod(self.path, 0o000)
|
|
199
|
+
client = HyperCacheClient(socket_path=self.path)
|
|
200
|
+
with self.assertRaises(ConnectionError) as ctx:
|
|
201
|
+
client.locate("hypercache://x/1", auto_ingest=False)
|
|
202
|
+
self.assertIn("client_gid", str(ctx.exception))
|
|
203
|
+
finally:
|
|
204
|
+
server.close()
|
|
205
|
+
|
|
190
206
|
@unittest.skipUnless(hasattr(os, "fork"), "requires fork()")
|
|
191
207
|
def test_client_reconnects_after_fork(self):
|
|
192
208
|
daemon = _EchoDaemon(self.path)
|
|
@@ -230,9 +246,7 @@ class TestDatapathReads(unittest.TestCase):
|
|
|
230
246
|
f.write(b"\0" * 8192)
|
|
231
247
|
|
|
232
248
|
def tearDown(self):
|
|
233
|
-
|
|
234
|
-
os.remove(os.path.join(self.dir, name))
|
|
235
|
-
os.rmdir(self.dir)
|
|
249
|
+
shutil.rmtree(self.dir, ignore_errors=True)
|
|
236
250
|
|
|
237
251
|
def _layout(self, chunk=65536, crc=True):
|
|
238
252
|
out = []
|
|
@@ -315,6 +329,30 @@ class TestDatapathReads(unittest.TestCase):
|
|
|
315
329
|
finally:
|
|
316
330
|
reader.close()
|
|
317
331
|
|
|
332
|
+
def test_ram_chunk_write_never_creates_a_private_shm_directory(self):
|
|
333
|
+
writer = DirectBlockWriter()
|
|
334
|
+
try:
|
|
335
|
+
# Directory missing: this process does not share /dev/shm with the daemon
|
|
336
|
+
missing_dir = os.path.join(self.dir, "unshared_shm")
|
|
337
|
+
loc = ChunkLocation(device=os.path.join(missing_dir, "c0.shm"), offset=0, length=100, tier="ram")
|
|
338
|
+
with self.assertRaises(FileNotFoundError) as ctx:
|
|
339
|
+
writer.write_chunks([loc], self.payload[:100])
|
|
340
|
+
self.assertIn("/dev/shm", str(ctx.exception))
|
|
341
|
+
self.assertFalse(os.path.exists(missing_dir))
|
|
342
|
+
|
|
343
|
+
# Shared directory with the daemon's pre-created file: written in place
|
|
344
|
+
shared_dir = os.path.join(self.dir, "shared_shm")
|
|
345
|
+
os.makedirs(shared_dir)
|
|
346
|
+
target = os.path.join(shared_dir, "c0.shm")
|
|
347
|
+
open(target, "wb").close()
|
|
348
|
+
loc = ChunkLocation(device=target, offset=0, length=100, tier="ram")
|
|
349
|
+
self.assertEqual(writer.write_chunks([loc], self.payload[:100]), 100)
|
|
350
|
+
with open(target, "rb") as f:
|
|
351
|
+
self.assertEqual(f.read(), self.payload[:100])
|
|
352
|
+
finally:
|
|
353
|
+
if hasattr(writer, "close"):
|
|
354
|
+
writer.close()
|
|
355
|
+
|
|
318
356
|
def test_chunk_location_round_trip_and_legacy(self):
|
|
319
357
|
legacy = ChunkLocation.from_dict({"device": "/dev/x", "offset": 4096, "length": 10})
|
|
320
358
|
self.assertIsNone(legacy.checksum)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|