aipmodel 0.2.73__tar.gz → 0.2.74__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.
- {aipmodel-0.2.73 → aipmodel-0.2.74}/PKG-INFO +1 -1
- {aipmodel-0.2.73 → aipmodel-0.2.74}/README.md +6 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel/__init__.py +1 -1
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel/exceptions.py +5 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel/model_registry.py +31 -2
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel.egg-info/PKG-INFO +1 -1
- {aipmodel-0.2.73 → aipmodel-0.2.74}/setup.py +1 -1
- {aipmodel-0.2.73 → aipmodel-0.2.74}/MANIFEST.in +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel/CephS3Manager.py +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel/acl_manager.py +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel/template.py +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel/update_checker.py +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel.egg-info/SOURCES.txt +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel.egg-info/dependency_links.txt +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel.egg-info/requires.txt +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/aipmodel.egg-info/top_level.txt +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/requirements.txt +0 -0
- {aipmodel-0.2.73 → aipmodel-0.2.74}/setup.cfg +0 -0
|
@@ -44,6 +44,12 @@ CEPH_ADMIN_SECRET_KEY="your_public_bucket_secret_key"
|
|
|
44
44
|
ACL_ENABLED="false"
|
|
45
45
|
ACL_API_HOST="http://your-acl-server:30011"
|
|
46
46
|
|
|
47
|
+
# Registry<->storage integrity (zombie/orphan) checks - opt-in, default off.
|
|
48
|
+
# When false, verify_model_integrity / verify_all_models / find_orphan_models
|
|
49
|
+
# raise IntegrityDisabledError instead of running the (S3-listing) consistency
|
|
50
|
+
# scan. Also settable per instance: MLOpsManager(..., INTEGRITY_ENABLED=True).
|
|
51
|
+
INTEGRITY_ENABLED="false"
|
|
52
|
+
|
|
47
53
|
# Optional overrides (all have sane defaults if omitted)
|
|
48
54
|
SDK_REQUEST_TIMEOUT="30"
|
|
49
55
|
MODEL_ALLOWED_CATEGORIES="Text Generation,Image Classification"
|
|
@@ -21,3 +21,8 @@ class MetadataError(ModelRegistryError):
|
|
|
21
21
|
|
|
22
22
|
class StorageError(ModelRegistryError):
|
|
23
23
|
"""S3 / Ceph operation failed (upload, download, copy, delete)."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class IntegrityDisabledError(ModelRegistryError):
|
|
27
|
+
"""An integrity/zombie-check operation was called while INTEGRITY_ENABLED is
|
|
28
|
+
off (the default). Enable it (kwarg or env) to run consistency scans."""
|
|
@@ -18,7 +18,7 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
|
18
18
|
|
|
19
19
|
from .CephS3Manager import CephS3Manager
|
|
20
20
|
from .acl_manager import AclManager
|
|
21
|
-
from .exceptions import ModelRegistryError, ModelNotFoundError, MetadataError, StorageError
|
|
21
|
+
from .exceptions import ModelRegistryError, ModelNotFoundError, MetadataError, StorageError, IntegrityDisabledError
|
|
22
22
|
|
|
23
23
|
load_dotenv()
|
|
24
24
|
|
|
@@ -368,6 +368,7 @@ class MLOpsManager:
|
|
|
368
368
|
skip_connection_check=False,
|
|
369
369
|
ACL_API_HOST=None,
|
|
370
370
|
ACL_ENABLED=None,
|
|
371
|
+
INTEGRITY_ENABLED=None,
|
|
371
372
|
MLOPS_CORE_API_HOST=None,
|
|
372
373
|
MLOPS_CORE_WEB_HOST=None
|
|
373
374
|
):
|
|
@@ -491,6 +492,16 @@ class MLOpsManager:
|
|
|
491
492
|
)
|
|
492
493
|
self.ACL_API_HOST = ACL_API_HOST or os.environ.get("ACL_API_HOST")
|
|
493
494
|
|
|
495
|
+
# --- Registry <-> Storage integrity checks (zombie/orphan detection) ---
|
|
496
|
+
# Toggle controlled by INTEGRITY_ENABLED (kwarg or .env). When disabled
|
|
497
|
+
# (the default), verify_model_integrity / verify_all_models /
|
|
498
|
+
# find_orphan_models refuse to run — the consistency scan lists S3 for
|
|
499
|
+
# every model, so it is opt-in rather than on by default.
|
|
500
|
+
self.INTEGRITY_ENABLED = self._to_bool(
|
|
501
|
+
INTEGRITY_ENABLED if INTEGRITY_ENABLED is not None else os.environ.get("INTEGRITY_ENABLED"),
|
|
502
|
+
default=False
|
|
503
|
+
)
|
|
504
|
+
|
|
494
505
|
if self.ACL_ENABLED:
|
|
495
506
|
if not self.ACL_API_HOST:
|
|
496
507
|
error_msg = "ACL_ENABLED is true but ACL_API_HOST is not configured"
|
|
@@ -1683,7 +1694,13 @@ class MLOpsManager:
|
|
|
1683
1694
|
"orphan_folders": [<S3 folders under the model not referenced by any version>],
|
|
1684
1695
|
}
|
|
1685
1696
|
Raises ModelNotFoundError if the model is not in the registry at all.
|
|
1697
|
+
Raises IntegrityDisabledError if INTEGRITY_ENABLED is off (the default).
|
|
1686
1698
|
"""
|
|
1699
|
+
if not self.INTEGRITY_ENABLED:
|
|
1700
|
+
raise IntegrityDisabledError(
|
|
1701
|
+
"Integrity checks are disabled. Enable them with INTEGRITY_ENABLED=true "
|
|
1702
|
+
"(constructor kwarg or environment variable)."
|
|
1703
|
+
)
|
|
1687
1704
|
if not model_id:
|
|
1688
1705
|
model_id = self.get_model_id_by_name(model_name)
|
|
1689
1706
|
if not model_id:
|
|
@@ -1748,7 +1765,13 @@ class MLOpsManager:
|
|
|
1748
1765
|
def verify_all_models(self):
|
|
1749
1766
|
"""Run verify_model_integrity over every model in the user's project.
|
|
1750
1767
|
Returns a list of per-model reports (never raises per-model; a model
|
|
1751
|
-
that fails to verify is reported with status "error").
|
|
1768
|
+
that fails to verify is reported with status "error").
|
|
1769
|
+
Raises IntegrityDisabledError if INTEGRITY_ENABLED is off (the default)."""
|
|
1770
|
+
if not self.INTEGRITY_ENABLED:
|
|
1771
|
+
raise IntegrityDisabledError(
|
|
1772
|
+
"Integrity checks are disabled. Enable them with INTEGRITY_ENABLED=true "
|
|
1773
|
+
"(constructor kwarg or environment variable)."
|
|
1774
|
+
)
|
|
1752
1775
|
reports = []
|
|
1753
1776
|
models = self.models.get_all(self.project_id) or []
|
|
1754
1777
|
for m in models:
|
|
@@ -1770,7 +1793,13 @@ class MLOpsManager:
|
|
|
1770
1793
|
Find S3 model folders (under `_models/`) that the registry does NOT
|
|
1771
1794
|
know about — e.g. leftovers after a registry (Mlops-Core) data loss.
|
|
1772
1795
|
Returns [{"model_id", "recoverable" (has _meta.json), "meta": {...}|None}].
|
|
1796
|
+
Raises IntegrityDisabledError if INTEGRITY_ENABLED is off (the default).
|
|
1773
1797
|
"""
|
|
1798
|
+
if not self.INTEGRITY_ENABLED:
|
|
1799
|
+
raise IntegrityDisabledError(
|
|
1800
|
+
"Integrity checks are disabled. Enable them with INTEGRITY_ENABLED=true "
|
|
1801
|
+
"(constructor kwarg or environment variable)."
|
|
1802
|
+
)
|
|
1774
1803
|
mgr = self._get_ceph_manager(False)
|
|
1775
1804
|
registry_ids = {m.get("id") for m in (self.models.get_all(self.project_id) or [])}
|
|
1776
1805
|
s3_ids = set()
|
|
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
|