Skip to content

Commit b54a24d

Browse files
Improve error messaging for comparisons involving entrypoints (#2276)
Make error messaging more specific for cases where entrypoint` names must match other names (e.g. catalog types schema_names and runtime schema file names)
1 parent ef4d733 commit b54a24d

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

elyra/metadata/schemasproviders.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from typing import List
2222

2323
import entrypoints
24+
from traitlets import log # noqa H306
2425
try:
2526
from kfp_tekton import TektonClient
2627
except ImportError:
@@ -48,6 +49,7 @@ class ElyraSchemasProvider(SchemasProvider, metaclass=ABCMeta):
4849
local_schemas.append(schema_json)
4950

5051
def __init__(self):
52+
self.log = log.get_logger()
5153
# get set of registered runtimes
5254
self._runtime_processor_names = set()
5355
for processor in entrypoints.get_group_all('elyra.pipeline.processors'):
@@ -79,6 +81,9 @@ def get_schemas(self) -> List[Dict]:
7981
runtime_schemas.append(schema)
8082
if schema['name'] == 'kfp':
8183
kfp_needed = True
84+
else:
85+
self.log.error(f"No entrypoint with name '{schema['name']}' was found in group "
86+
f"'elyra.pipeline.processor' to match the schema with the same name. Skipping...")
8287

8388
if kfp_needed: # Update the kfp engine enum to reflect current packages...
8489
# If TektonClient package is missing, navigate to the engine property

elyra/pipeline/catalog_connector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def read_component_definitions(self, catalog_instance: Metadata) -> Dict[str, Di
246246

247247
except NotImplementedError as e:
248248
err_msg = f"{self.__class__.__name__} does not meet the requirements of a catalog connector class: {e}"
249-
self.log.warning(err_msg)
249+
self.log.error(err_msg)
250250
except Exception as e:
251251
err_msg = f"Could not get catalog entry information for catalog '{catalog_instance.display_name}': {e}"
252252
# Dump stack trace with error message
@@ -290,7 +290,7 @@ def read_with_thread():
290290

291291
except NotImplementedError as e:
292292
msg = f"{self.__class__.__name__} does not meet the requirements of a catalog connector class: {e}."
293-
self.log.warning(msg)
293+
self.log.error(msg)
294294
except Exception as e:
295295
# Dump stack trace with error message and continue
296296
self.log.exception(f"Could not read definition for catalog entry with identifying information: "

elyra/pipeline/component_registry.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,15 @@ def _read_component_catalogs(self, catalogs: Optional[List[Metadata]] = None) ->
240240
for catalog in catalogs:
241241
# Assign reader based on the type of the catalog (the 'schema_name')
242242
try:
243-
catalog_reader = entrypoints.get_group_named('elyra.component.catalog_types')\
244-
.get(catalog.schema_name)\
245-
.load()(self._parser.file_types, parent=self.parent)
243+
catalog_reader = entrypoints.get_group_named('elyra.component.catalog_types').get(catalog.schema_name)
244+
if not catalog_reader:
245+
self.log.error(f"No entrypoint with name '{catalog.schema_name}' was found in group "
246+
f"'elyra.component.catalog_types' to match the 'schema_name' given in catalog "
247+
f"'{catalog.display_name}'. Skipping...")
248+
continue
249+
catalog_reader = catalog_reader.load()(self._parser.file_types, parent=self.parent)
246250
except Exception as e:
247-
self.log.warning(f"Could not load appropriate ComponentCatalogConnector class: {e}. Skipping...")
251+
self.log.error(f"Could not load appropriate ComponentCatalogConnector class: {e}. Skipping...")
248252
continue
249253

250254
# Get content of component definition file for each component in this catalog

0 commit comments

Comments
 (0)