Skip to content

Commit f435355

Browse files
committed
log warning
1 parent f35588d commit f435355

File tree

2 files changed

+29
-4
lines changed
  • packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/catalog
  • services/catalog/src/simcore_service_catalog/service

2 files changed

+29
-4
lines changed

packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/catalog/errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ class CatalogApiBaseError(OsparcErrorMixin, Exception):
55
pass
66

77

8+
class CatalogInconsistentError(CatalogApiBaseError):
9+
msg_template = "Catalog is inconsistent: The following services are in the database but missing in the registry manifest {missing_services}"
10+
11+
812
class CatalogItemNotFoundError(CatalogApiBaseError):
913
msg_template = "{name} was not found"
1014

services/catalog/src/simcore_service_catalog/service/services.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
from models_library.services_types import ServiceKey, ServiceVersion
1919
from models_library.users import UserID
2020
from pydantic import HttpUrl, NonNegativeInt
21+
from servicelib.logging_errors import (
22+
create_troubleshotting_log_kwargs,
23+
)
2124
from servicelib.rabbitmq.rpc_interfaces.catalog.errors import (
2225
CatalogForbiddenError,
26+
CatalogInconsistentError,
2327
CatalogItemNotFoundError,
2428
)
2529

@@ -149,7 +153,7 @@ async def list_latest_services(
149153
product_name=product_name,
150154
)
151155

152-
# get manifest of those with access rights
156+
# Get manifest of those with access rights
153157
got = await manifest.get_batch_services(
154158
[
155159
(sc.key, sc.version)
@@ -164,10 +168,27 @@ async def list_latest_services(
164168
if isinstance(sc, ServiceMetaDataPublished)
165169
}
166170

167-
# FIXME: services (key, version) matches not found in manifest means that they are in the database but they
168-
# do not really exist in the service. We cannot include them but we should definitively warn!!
169-
# All services in database should be include in the registry. The background task should be responsible of that
171+
# Log a warning for missing services
172+
missing_services = [
173+
(sc.key, sc.version)
174+
for sc in services
175+
if (sc.key, sc.version) not in service_manifest
176+
]
177+
if missing_services:
178+
msg = f"Found {len(missing_services)} services that are in the database but missing in the registry manifest"
179+
_logger.warning(
180+
**create_troubleshotting_log_kwargs(
181+
msg,
182+
error=CatalogInconsistentError(
183+
missing_services=missing_services,
184+
user_id=user_id,
185+
product_name=product_name,
186+
),
187+
tip="This might be due to malfunction of the background-task or that this call was done while the sync was taking place",
188+
)
189+
)
170190

191+
# Aggregate the services manifest and access-rights
171192
items = [
172193
_to_latest_get_schema(
173194
service_db=sc,

0 commit comments

Comments
 (0)