Skip to content

Commit

Permalink
Improve error messaging for comparisons involving entrypoints (#2276)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
kiersten-stokes authored Nov 5, 2021
1 parent ef4d733 commit b54a24d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions elyra/metadata/schemasproviders.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from typing import List

import entrypoints
from traitlets import log # noqa H306
try:
from kfp_tekton import TektonClient
except ImportError:
Expand Down Expand Up @@ -48,6 +49,7 @@ class ElyraSchemasProvider(SchemasProvider, metaclass=ABCMeta):
local_schemas.append(schema_json)

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

if kfp_needed: # Update the kfp engine enum to reflect current packages...
# If TektonClient package is missing, navigate to the engine property
Expand Down
4 changes: 2 additions & 2 deletions elyra/pipeline/catalog_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def read_component_definitions(self, catalog_instance: Metadata) -> Dict[str, Di

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

except NotImplementedError as e:
msg = f"{self.__class__.__name__} does not meet the requirements of a catalog connector class: {e}."
self.log.warning(msg)
self.log.error(msg)
except Exception as e:
# Dump stack trace with error message and continue
self.log.exception(f"Could not read definition for catalog entry with identifying information: "
Expand Down
12 changes: 8 additions & 4 deletions elyra/pipeline/component_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,15 @@ def _read_component_catalogs(self, catalogs: Optional[List[Metadata]] = None) ->
for catalog in catalogs:
# Assign reader based on the type of the catalog (the 'schema_name')
try:
catalog_reader = entrypoints.get_group_named('elyra.component.catalog_types')\
.get(catalog.schema_name)\
.load()(self._parser.file_types, parent=self.parent)
catalog_reader = entrypoints.get_group_named('elyra.component.catalog_types').get(catalog.schema_name)
if not catalog_reader:
self.log.error(f"No entrypoint with name '{catalog.schema_name}' was found in group "
f"'elyra.component.catalog_types' to match the 'schema_name' given in catalog "
f"'{catalog.display_name}'. Skipping...")
continue
catalog_reader = catalog_reader.load()(self._parser.file_types, parent=self.parent)
except Exception as e:
self.log.warning(f"Could not load appropriate ComponentCatalogConnector class: {e}. Skipping...")
self.log.error(f"Could not load appropriate ComponentCatalogConnector class: {e}. Skipping...")
continue

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

0 comments on commit b54a24d

Please sign in to comment.