Skip to content

Commit

Permalink
Revert "Remove read_entry_data method from class ComponentCatalogConn…
Browse files Browse the repository at this point in the history
…ector (#3141) (#3266)

* Revert "Remove obsolete read_entry_data method from class ComponentCatalogConnector (#3141)"

This reverts commit a60ae72.
This is breaking the build as it seems its not complete yet.

Signed-off-by: Luciano Resende <[email protected]>

* Update yarn.lock

Signed-off-by: Luciano Resende <[email protected]>

* Pin mistune

Signed-off-by: Luciano Resende <[email protected]>

---------

Signed-off-by: Luciano Resende <[email protected]>
  • Loading branch information
lresende authored Jan 1, 2025
1 parent a60ae72 commit 6eef65b
Show file tree
Hide file tree
Showing 4 changed files with 3,051 additions and 3,014 deletions.
2 changes: 1 addition & 1 deletion elyra/pipeline/airflow/package_catalog_connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ If the Airflow package is stored on PyPI:
If the palette does not include the expected operators check the JupyterLab log file for error messages. Error messages include the component catalog name, as shown in this example:
```
Error. The Airflow package connector '<CATALOG_NAME>' encountered an issue downloading '<URL>'. HTTP response code: <HTTP_CODE>
```
```
49 changes: 42 additions & 7 deletions elyra/pipeline/catalog_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
from typing import Optional
from urllib.parse import urlparse

from deprecation import deprecated
from jupyter_core.paths import ENV_JUPYTER_PATH
from requests.auth import HTTPBasicAuth
from requests.sessions import Session
from traitlets.config import LoggingConfigurable
from traitlets.traitlets import default
from traitlets.traitlets import Integer

from elyra._version import __version__
from elyra.metadata.metadata import Metadata
from elyra.pipeline.component import Component
from elyra.pipeline.properties import ComponentProperty
Expand Down Expand Up @@ -219,6 +221,39 @@ def get_catalog_entries(self, catalog_metadata: Dict[str, Any]) -> List[Dict[str
"""
raise NotImplementedError("abstract method 'get_catalog_entries()' must be implemented")

@deprecated(
deprecated_in="3.7.0",
removed_in="4.0",
current_version=__version__,
details="Implement the get_entry_data function instead",
)
def read_catalog_entry(self, catalog_entry_data: Dict[str, Any], catalog_metadata: Dict[str, Any]) -> Optional[str]:
"""
DEPRECATED. Will be removed in 4.0. get_entry_data() must be implemented instead.
Reads a component definition for a single catalog entry using the catalog_entry_data returned
from get_catalog_entries() and, if needed, the catalog metadata.
:param catalog_entry_data: a dictionary that contains the information needed to read the content
of the component definition; below is an example data structure returned
from get_catalog_entries()
example:
{
"directory_path": "/Users/path/to/directory",
"relative_path": "subdir/file.py"
}
:param catalog_metadata: the metadata associated with the catalog in which this catalog entry is
stored; this is the same dictionary that is passed into get_catalog_entries();
in addition to catalog_entry_data, catalog_metadata may also be
needed to read the component definition for certain types of catalogs
:returns: the content of the given catalog entry's definition in string form, if found, or None;
if None is returned, this catalog entry is skipped and a warning message logged
"""
raise NotImplementedError("abstract method 'read_catalog_entry()' must be implemented")

def get_entry_data(
self, catalog_entry_data: Dict[str, Any], catalog_metadata: Dict[str, Any]
) -> Optional[EntryData]:
Expand Down Expand Up @@ -372,18 +407,18 @@ def read_with_thread():
)

try:
# Attempt to get an EntryData object from get_entry_data
# Attempt to get an EntryData object from get_entry_data first
entry_data: EntryData = self.get_entry_data(
catalog_entry_data=catalog_entry_data, catalog_metadata=catalog_metadata
)
except NotImplementedError:
self.log.error(
f"Component catalog connector {self.__class__.__name__} cannot process catalog entry "
f"with identifying information {catalog_entry_data}. "
f"The connector does not implement method 'get_entry_data'."
# Connector class does not implement get_catalog_definition and we must
# manually coerce this entry's returned values into a EntryData object
definition = self.read_catalog_entry(
catalog_entry_data=catalog_entry_data, catalog_metadata=catalog_metadata
)
catalog_entry_q.task_done()
continue

entry_data: EntryData = EntryData(definition=definition)

# Ignore this entry if no definition content is returned
if not entry_data or not entry_data.definition:
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ airflow-gitlab = [
kfp = [
"kfp>=1.7.0,<2.0,!=1.7.2", # We cap the SDK to <2.0 due to possible breaking changes
"typing-extensions>=3.10,<5", # Cap from kfp
"mistune<3.1.0",
]
kfp-tekton = [
"kfp-tekton>=1.5.2" # requires kfp >= 1.8.19, which contains fix for Jupyterlab
"kfp-tekton>=1.5.2", # requires kfp >= 1.8.19, which contains fix for Jupyterlab
"mistune<3.1.0",
]
kfp-examples = [
"elyra-examples-kfp-catalog"
"elyra-examples-kfp-catalog",
]
# The following is a collection of "non-test" extra dependencies from above.
all = [
Expand Down
Loading

0 comments on commit 6eef65b

Please sign in to comment.