29
29
# We may not have kfp-tekton available and that's okay!
30
30
TektonClient = None
31
31
32
+ try:
33
+ from kfp import compiler # noqa
34
+ except ImportError:
35
+ # KFP python package is not installed
36
+ compiler = None
37
+
38
+ try:
39
+ # Check to see if Airflow package is installed, since we do not have any dependencies
40
+ # on any Airflow package, we use GitHub as our canary
41
+ from github import Github # noqa
42
+ except ImportError:
43
+ # Github package is not installed, we use GitHub as our default DAG repository
44
+ Github = None
45
+
32
46
from elyra.metadata.schema import SchemasProvider
33
47
from elyra.metadata.schemaspaces import CodeSnippets
34
48
from elyra.metadata.schemaspaces import ComponentCatalogs
@@ -51,7 +65,7 @@ class ElyraSchemasProvider(SchemasProvider, metaclass=ABCMeta):
51
65
schema_json = json.load(f)
52
66
local_schemas.append(schema_json)
53
67
54
- def __init__(self):
68
+ def __init__(self, *args, **kwargs ):
55
69
self.log = log.get_logger()
56
70
# get set of registered runtimes
57
71
self._runtime_processor_names = set()
@@ -82,17 +96,17 @@ def get_schemas(self) -> List[Dict]:
82
96
schemas = self.get_local_schemas_by_schemaspace(Runtimes.RUNTIMES_SCHEMASPACE_ID)
83
97
for schema in schemas:
84
98
if schema["name"] in self._runtime_processor_names:
85
- runtime_schemas.append(schema)
86
- if schema["name"] == "kfp":
99
+ if schema["name"] == "kfp" and compiler:
87
100
kfp_schema_present = True
88
- elif schema["name"] == "airflow":
101
+ runtime_schemas.append(schema)
102
+ elif schema["name"] == "airflow" and Github:
89
103
airflow_schema_present = True
104
+ runtime_schemas.append(schema)
90
105
else:
91
106
self.log.error(
92
107
f"No entrypoint with name '{schema['name']}' was found in group "
93
108
f"'elyra.pipeline.processor' to match the schema with the same name. Skipping..."
94
109
)
95
-
96
110
if kfp_schema_present: # Update the kfp engine enum to reflect current packages...
97
111
# If TektonClient package is missing, navigate to the engine property
98
112
# and remove 'tekton' entry if present and return updated result.
0 commit comments