Skip to content

Commit

Permalink
ignore wkrm loading errors, as that would prevent an initial load
Browse files Browse the repository at this point in the history
  • Loading branch information
philtweir committed Dec 21, 2023
1 parent 5cf1d25 commit 9af92bb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions arches_orm/wkrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ def get_resource_models_for_adapter(adapter_name: str | None = None):
adapter = get_adapter(adapter_name)
if str(adapter) not in resource_models:
resource_models[str(adapter)] = {}
resource_models[str(adapter)]["by-class"] = {
wkrm.model_class_name: _make_wkrm(wkrm, adapter)
for wkrm in WELL_KNOWN_RESOURCE_MODELS
}
resource_models[str(adapter)]["by-class"] = {}
for wkrm in WELL_KNOWN_RESOURCE_MODELS
try:
resource_models[str(adapter)]["by-class"][wkrm.model_class_name] = _make_wkrm(wkrm, adapter)
except Exception as exc:
logger.error("Could not load well-known resource model %s for adapter %s", str(wkrm.model_class_name), str(adapter))
logger.exception(exc)
logger.error("...continuing, to prevent circularity.")
resource_models[str(adapter)]["by-graph-id"] = {
rm.graphid: rm
for rm in resource_models[str(adapter)]["by-class"].values()
Expand Down

0 comments on commit 9af92bb

Please sign in to comment.