rms-filecache 3.2.0__tar.gz → 3.2.1__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.
- {rms_filecache-3.2.0/rms_filecache.egg-info → rms_filecache-3.2.1}/PKG-INFO +1 -1
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/filecache/_version.py +3 -3
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/filecache/file_cache.py +3 -3
- {rms_filecache-3.2.0 → rms_filecache-3.2.1/rms_filecache.egg-info}/PKG-INFO +1 -1
- rms_filecache-3.2.1/rms_filecache.egg-info/scm_version.json +8 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/test_file_cache.py +43 -0
- rms_filecache-3.2.0/rms_filecache.egg-info/scm_version.json +0 -8
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/.coveragerc +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/.flake8 +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/.github/pull_request_template.md +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/.github/workflows/publish_to_pypi.yml +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/.github/workflows/publish_to_test_pypi.yml +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/.github/workflows/run-tests.yml +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/.gitignore +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/.readthedocs.yaml +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/LICENSE +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/README.md +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/docs/Makefile +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/docs/conf.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/docs/examples.rst +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/docs/index.rst +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/docs/introduction.rst +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/docs/make.bat +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/docs/module.rst +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/filecache/__init__.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/filecache/file_cache_path.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/filecache/file_cache_source.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/filecache/file_cache_types.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/filecache/py.typed +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/mypy.ini +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/pyproject.toml +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/requirements.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/rms_filecache.egg-info/SOURCES.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/rms_filecache.egg-info/dependency_links.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/rms_filecache.egg-info/requires.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/rms_filecache.egg-info/scm_file_list.json +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/rms_filecache.egg-info/top_level.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/setup.cfg +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/test_files/expected/lorem1.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/test_files/expected/subdir1/lorem1.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/test_files/expected/subdir1/subdir2a/binary1.bin +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/test_files/expected/subdir1/subdir2b/binary1.bin +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/test_programs/locking.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/test_programs/multi_download.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/__init__.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/gs_lifecycle_config.json +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/gs_lifecycle_config_info.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/s3_bucket_policy_read.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/s3_bucket_policy_write.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/s3_lifecycle_policy.txt +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/test_file_cache_path.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/test_file_cache_source.py +0 -0
- {rms_filecache-3.2.0 → rms_filecache-3.2.1}/tests/test_url_mapping.py +0 -0
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '3.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (3, 2,
|
|
21
|
+
__version__ = version = '3.2.1'
|
|
22
|
+
__version_tuple__ = version_tuple = (3, 2, 1)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g9b7e269fe'
|
|
@@ -1330,7 +1330,7 @@ class FileCache:
|
|
|
1330
1330
|
lock = filelock.FileLock(lock_path, timeout=lock_timeout)
|
|
1331
1331
|
try:
|
|
1332
1332
|
lock.acquire()
|
|
1333
|
-
except filelock.
|
|
1333
|
+
except filelock.Timeout as e:
|
|
1334
1334
|
if exception_on_fail:
|
|
1335
1335
|
raise
|
|
1336
1336
|
return e
|
|
@@ -1607,7 +1607,7 @@ class FileCache:
|
|
|
1607
1607
|
lock = filelock.FileLock(lock_path, timeout=0)
|
|
1608
1608
|
try:
|
|
1609
1609
|
lock.acquire()
|
|
1610
|
-
except filelock.
|
|
1610
|
+
except filelock.Timeout:
|
|
1611
1611
|
self._log_debug(f' Failed to lock: {sub_path}')
|
|
1612
1612
|
wait_to_appear.append((idx, f'{source_pfx}{sub_path}', local_path,
|
|
1613
1613
|
lock_path, source, sub_path))
|
|
@@ -1695,7 +1695,7 @@ class FileCache:
|
|
|
1695
1695
|
stale_lock_items.append(
|
|
1696
1696
|
(idx, url, local_path, lock_path, stale_lock, source, sub_path))
|
|
1697
1697
|
self._log_debug(f' Stale lock detected for {url}, will re-download')
|
|
1698
|
-
except filelock.
|
|
1698
|
+
except filelock.Timeout:
|
|
1699
1699
|
# Lock is actively held -- another process is still downloading.
|
|
1700
1700
|
new_wait_to_appear.append(
|
|
1701
1701
|
(idx, url, local_path, lock_path, source, sub_path))
|
|
@@ -9,6 +9,7 @@ import datetime
|
|
|
9
9
|
import os
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
import platform
|
|
12
|
+
import re
|
|
12
13
|
import tempfile
|
|
13
14
|
import threading
|
|
14
15
|
import time
|
|
@@ -1247,6 +1248,48 @@ def test_stale_lock_multi_pfx():
|
|
|
1247
1248
|
assert fc.upload_counter == 0
|
|
1248
1249
|
|
|
1249
1250
|
|
|
1251
|
+
@pytest.mark.skipif(platform.system() == 'Windows',
|
|
1252
|
+
reason='A read-only directory mode does not stop file creation')
|
|
1253
|
+
@pytest.mark.skipif(hasattr(os, 'geteuid') and os.geteuid() == 0,
|
|
1254
|
+
reason='root can create files in a read-only directory')
|
|
1255
|
+
def test_locking_read_only_dir_single():
|
|
1256
|
+
"""A lock file that cannot be created raises its PermissionError (single file)."""
|
|
1257
|
+
with FileCache(cache_name=None, mp_safe=True) as fc:
|
|
1258
|
+
url = f'{HTTP_TEST_ROOT}/{EXPECTED_FILENAMES[0]}'
|
|
1259
|
+
lock_path = fc._lock_path(fc.get_local_path(url))
|
|
1260
|
+
lock_dir = lock_path.parent
|
|
1261
|
+
lock_dir.chmod(0o555)
|
|
1262
|
+
try:
|
|
1263
|
+
with pytest.raises(PermissionError, match=re.escape(lock_path.name)):
|
|
1264
|
+
fc.retrieve(url)
|
|
1265
|
+
finally:
|
|
1266
|
+
lock_dir.chmod(0o755)
|
|
1267
|
+
assert fc.download_counter == 0
|
|
1268
|
+
assert not fc.cache_dir.exists()
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
@pytest.mark.skipif(platform.system() == 'Windows',
|
|
1272
|
+
reason='A read-only directory mode does not stop file creation')
|
|
1273
|
+
@pytest.mark.skipif(hasattr(os, 'geteuid') and os.geteuid() == 0,
|
|
1274
|
+
reason='root can create files in a read-only directory')
|
|
1275
|
+
def test_locking_read_only_dir_multi():
|
|
1276
|
+
"""A lock file that cannot be created raises its PermissionError (multiple files)."""
|
|
1277
|
+
with FileCache(cache_name=None, mp_safe=True) as fc:
|
|
1278
|
+
urls = [f'{HTTP_TEST_ROOT}/{f}' for f in EXPECTED_FILENAMES]
|
|
1279
|
+
# Create every parent directory now, so that only the lock can fail
|
|
1280
|
+
local_paths = fc.get_local_path(urls)
|
|
1281
|
+
lock_path = fc._lock_path(local_paths[0])
|
|
1282
|
+
lock_dir = lock_path.parent
|
|
1283
|
+
lock_dir.chmod(0o555)
|
|
1284
|
+
try:
|
|
1285
|
+
with pytest.raises(PermissionError, match=re.escape(lock_path.name)):
|
|
1286
|
+
fc.retrieve(urls)
|
|
1287
|
+
finally:
|
|
1288
|
+
lock_dir.chmod(0o755)
|
|
1289
|
+
assert fc.download_counter == 0
|
|
1290
|
+
assert not fc.cache_dir.exists()
|
|
1291
|
+
|
|
1292
|
+
|
|
1250
1293
|
def test_cleanup_locking_bad():
|
|
1251
1294
|
logger = MyLogger()
|
|
1252
1295
|
with FileCache(cache_name=None, logger=logger) as fc:
|
|
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
|
|
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
|
{rms_filecache-3.2.0 → rms_filecache-3.2.1}/test_files/expected/subdir1/subdir2a/binary1.bin
RENAMED
|
File without changes
|
{rms_filecache-3.2.0 → rms_filecache-3.2.1}/test_files/expected/subdir1/subdir2b/binary1.bin
RENAMED
|
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
|