Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support Runtime types #2263

Merged
merged 89 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
8534d61
Promote component-registrsy schema catalog type
kiersten-stokes Oct 18, 2021
28aaa95
Update resource locations
kiersten-stokes Oct 18, 2021
445265b
Fix schema const fields
kiersten-stokes Oct 18, 2021
d6ea8a2
Generalize the reader classes
kiersten-stokes Oct 19, 2021
494d5e7
Refine generalization of processing
kiersten-stokes Oct 19, 2021
e8822c8
Remove reader from Component object
kiersten-stokes Oct 19, 2021
e1c3498
Change hashing method and add processing-specific function
kiersten-stokes Oct 19, 2021
1bfffd1
Merge branch 'master' into registry-updates
kiersten-stokes Oct 19, 2021
85e91ef
Add first-pass support for airflow processor
kiersten-stokes Oct 19, 2021
27add8b
Change location_type var to catalog_type
kiersten-stokes Oct 19, 2021
4ed39d1
Change names of things on the frontend
kiersten-stokes Oct 19, 2021
e077dfd
Add component-registry schema back to schemas folder
kiersten-stokes Oct 19, 2021
107e373
Initial migration changes for BYO catalog types
kevin-bates Oct 19, 2021
66a57bb
Merge branch 'registry-migration' into kiersten-registry-updates
kevin-bates Oct 19, 2021
dbb1eb6
Add support for deprecated schemas
kevin-bates Oct 20, 2021
2a41f26
linting
kevin-bates Oct 20, 2021
81942b9
Add version to component-registry factory instances
kevin-bates Oct 20, 2021
2d6c98e
Apply constant values if missing, rename post_load to on_load
kevin-bates Oct 20, 2021
7066aea
Auto-discover local schemas for each SchemasProvider
kevin-bates Oct 20, 2021
4059d73
Address minor review comments
kiersten-stokes Oct 20, 2021
e13a0bc
Merge remote-tracking branch 'origin/registry-updates' into registry-…
kiersten-stokes Oct 20, 2021
c0803a1
Rename functions and arguments
kiersten-stokes Oct 21, 2021
e9e8aba
Restructure read_component_definitions() function
kiersten-stokes Oct 22, 2021
047d69d
Add fully-qualified airflow operator names to configuration
kevin-bates Oct 22, 2021
0549de5
Merge remote-tracking branch 'kiersten-stokes/registry-updates' into …
kevin-bates Oct 22, 2021
bacdb83
Merge remote-tracking branch 'upstream/master' into kiersten-registry…
kevin-bates Oct 22, 2021
8e26ac2
Change get_component_hash_keys() to get_hash_keys()
kiersten-stokes Oct 22, 2021
f59955f
Merge branch 'registry-updates' of https://github.com/kiersten-stokes…
kiersten-stokes Oct 22, 2021
11ab991
Fix missing function call
kiersten-stokes Oct 22, 2021
52226a0
Ensure component-registries schemas have runtime property
kevin-bates Oct 22, 2021
87c9be4
Fix metadata tests
kevin-bates Oct 22, 2021
6baee11
Improve error messaging and change name of component_reader file
kiersten-stokes Oct 22, 2021
abb351b
Fix test imports so tests run
kevin-bates Oct 23, 2021
f6f2ca3
Rearrange abstract methods
kiersten-stokes Oct 25, 2021
18b8ffe
Merge branch 'registry-updates' of https://github.com/kiersten-stokes…
kiersten-stokes Oct 25, 2021
07f4f4b
Add configurable dictionary for connector class settings
kiersten-stokes Oct 25, 2021
8afbf50
Catch errors and dump stack trace in some cases
kiersten-stokes Oct 25, 2021
a9e9a8c
Add an option to include subdirectories for directory catalogs
kiersten-stokes Oct 25, 2021
85844f5
Fix syntax error in Airflow DAG template
kiersten-stokes Oct 26, 2021
b3b7567
Make first pass at updating tests (not resources)
kiersten-stokes Oct 26, 2021
c40962b
Clean up typehints in Component object
kiersten-stokes Oct 26, 2021
c4fc239
Rename certain 'registry' vars as 'catalog' vars
kiersten-stokes Oct 26, 2021
b40bfef
Add parent info to support configuration traitlet
kiersten-stokes Oct 27, 2021
39b6bef
Updates to CCC class docstrings
kiersten-stokes Oct 27, 2021
e1a55dc
Add more return-type info to read_component_definition
kiersten-stokes Oct 27, 2021
44dcae3
Rename the location Component attribute to be more generic
kiersten-stokes Oct 27, 2021
74558f5
Add filtering logic to include a ComponentCatalogMetadata class to al…
kiersten-stokes Oct 27, 2021
461bfaf
Change file-based component hash key to use relative keys
kiersten-stokes Oct 27, 2021
0d8af1f
Make additional docstring edits
kiersten-stokes Oct 28, 2021
bfdc197
Address review comments
kiersten-stokes Oct 28, 2021
3bf296e
Remove mentions of metadata for individual entries
kiersten-stokes Oct 28, 2021
b6885e4
Add boolean input
marthacryan Oct 28, 2021
f3d45a2
Merge remote 'registry-updates' branch into local
kiersten-stokes Oct 28, 2021
25aec51
Add test numeric fields to directory catalog
kiersten-stokes Oct 28, 2021
e5f3fb7
Update tests to reflect recent variable name changes
kiersten-stokes Oct 28, 2021
799ef3c
Change function name
kiersten-stokes Oct 28, 2021
9ac575d
Merge master
kiersten-stokes Oct 28, 2021
2622bd4
Fix typos from review comments
kiersten-stokes Oct 29, 2021
f883cd9
Rename airflow preconfig catalog json as filesystem
kiersten-stokes Oct 29, 2021
6f26712
Update test resources
kiersten-stokes Oct 29, 2021
b5f2317
Sort schema for the add button in the metadata widget
marthacryan Oct 29, 2021
5742492
Merge branch 'registry-updates' of github.com:kiersten-stokes/elyra i…
marthacryan Oct 29, 2021
f640fa2
Merge remote 'registry-updates' branch into local
kiersten-stokes Oct 29, 2021
790518f
Add required numberm field to directory schema for testing
kiersten-stokes Oct 29, 2021
70c060a
Remove error-raising in catalog_connector and component_registry
kiersten-stokes Oct 29, 2021
9d8aa2f
Add support for runtime processor type
kevin-bates Oct 30, 2021
3ce373f
Merge branch 'kiersten-registry-updates' into runtime-type
kevin-bates Oct 30, 2021
3c5e399
Address/remove TODOs in metadata
kevin-bates Oct 30, 2021
15b5e46
Remove required number field since only for testing
kevin-bates Oct 30, 2021
ce5cf9b
Migrate runtime instances to include runtime_type value
kevin-bates Oct 31, 2021
cd5b29f
Initial front-end changes, reference new format in back-end
kevin-bates Nov 2, 2021
17482ba
Merge remote-tracking branch 'upstream/master' into runtime-types
kevin-bates Nov 2, 2021
5de0ff0
Update tests where necessary, handle generic pipeline types
kevin-bates Nov 4, 2021
e4c272b
Update integration test pipeline assets
kevin-bates Nov 4, 2021
b5cba83
Fix some icon mappings
kevin-bates Nov 5, 2021
4b65b67
Update integration test snapshots
kevin-bates Nov 5, 2021
d4e5200
Merge remote-tracking branch 'upstream/master' into runtime-types
kevin-bates Nov 5, 2021
8eb34a5
Fix validation of local pipelines, update complex snapshot
kevin-bates Nov 5, 2021
aee54dc
Fix snapshot to conform to structure, remove console.log stmts
kevin-bates Nov 6, 2021
a9d6044
Enable building Elyra docker image from current source code (#2274)
lresende Nov 8, 2021
a4ec683
Improve KF authentication handling (#2257)
ptitzler Nov 8, 2021
8d5e5ee
Merge remote-tracking branch 'upstream/master' into runtime-types
kevin-bates Nov 8, 2021
4d0fa01
Additional changes due to merge
kevin-bates Nov 8, 2021
3f8e566
Merge remote-tracking branch 'upstream/master' into runtime-types
kevin-bates Nov 9, 2021
c8610f3
Serialize appropriate runtime-type value
kevin-bates Nov 9, 2021
7e0f31e
Remove version indicator from catalog schemas
kevin-bates Nov 9, 2021
c5252c7
Fix some issues found during review/test
kevin-bates Nov 9, 2021
3a65068
Get ComponentCatalog from PipelineRegistry based on type
kevin-bates Nov 10, 2021
8028bcb
Update submission dialogs with appropriate runtime indicators
kevin-bates Nov 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions elyra/metadata/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ class Metadata(object):
resource = None
display_name = None
schema_name = None
version = None
metadata = {}
reason = None

def __init__(self, **kwargs: Any) -> None:
self.name = kwargs.get('name')
self.display_name = kwargs.get('display_name')
self.schema_name = kwargs.get('schema_name')
self.version = kwargs.get('version', 0)
self.metadata = kwargs.get('metadata', {})
self.resource = kwargs.get('resource')
self.reason = kwargs.get('reason')
Expand Down Expand Up @@ -112,8 +110,7 @@ def from_dict(cls: Type[M], schemaspace: str, metadata_dict: dict) -> M:
def to_dict(self, trim: bool = False) -> dict:
# Exclude resource, and reason only if trim is True since we don't want to persist that information.
# Method prepare_write will be used to remove name prior to writes.
d = dict(name=self.name, display_name=self.display_name, metadata=self.metadata,
schema_name=self.schema_name, version=self.version or 0)
d = dict(name=self.name, display_name=self.display_name, metadata=self.metadata, schema_name=self.schema_name)
if not trim:
if self.resource:
d['resource'] = self.resource
Expand Down
8 changes: 8 additions & 0 deletions elyra/metadata/schemas/airflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"display_name": "Apache Airflow",
"schemaspace": "runtimes",
"schemaspace_id": "130b8e00-de7c-4b32-b553-b4a52824a3b5",
"metadata_class_name": "elyra.pipeline.runtimes_metadata.RuntimesMetadata",
"runtime_type": "APACHE_AIRFLOW",
"uihints": {
"title": "Apache Airflow runtimes",
"icon": "elyra:runtimes",
Expand All @@ -28,6 +30,12 @@
"description": "Additional data specific to this metadata",
"type": "object",
"properties": {
"runtime_type": {
"title": "Runtime Type",
"description": "The runtime associated with this instance",
"type": "string",
"const": "APACHE_AIRFLOW"
},
"description": {
"title": "Description",
"description": "Description of this Apache Airflow configuration",
Expand Down
7 changes: 7 additions & 0 deletions elyra/metadata/schemas/kfp.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"schemaspace": "runtimes",
"schemaspace_id": "130b8e00-de7c-4b32-b553-b4a52824a3b5",
"metadata_class_name": "elyra.pipeline.kfp.kfp_metadata.KfpMetadata",
"runtime_type": "KUBEFLOW_PIPELINES",
"uihints": {
"title": "Kubeflow Pipelines runtimes",
"icon": "elyra:runtimes",
Expand All @@ -29,6 +30,12 @@
"description": "Additional data specific to this metadata",
"type": "object",
"properties": {
"runtime_type": {
"title": "Runtime Type",
"description": "The runtime associated with this instance",
"type": "string",
"const": "KUBEFLOW_PIPELINES"
},
"description": {
"title": "Description",
"description": "Description of this Kubeflow Pipelines configuration",
Expand Down
19 changes: 6 additions & 13 deletions elyra/metadata/schemas/local-directory-catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
"type": "string",
"minLength": 1
},
"version": {
"title": "Version",
"description": "The version associated with this instance",
"type": "integer",
"const": 1
},
"metadata": {
"description": "Additional data specific to this metadata",
"type": "object",
Expand All @@ -39,12 +33,11 @@
"description": "Description of this Component Catalog",
"type": "string"
},
"runtime": {
"title": "Runtime",
"description": "The runtime associated with this Component Catalog",
"runtime_type": {
"title": "Runtime Type",
"description": "The type of runtime associated with this Component Catalog",
"type": "string",
"$comment": "This enum is dynamically generated to contain the available runtime values.",
"enum": ["{currently-configured-runtimes}"],
"enum": ["KUBEFLOW_PIPELINES", "APACHE_AIRFLOW"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires updates to schemas (elyra code) every time you add external runtime (e.g. ARGO).
How about making a runtime error that the runtime type was not found?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was that these are explicit because each runtime type must be qualified. Once qualified the new type can be added. This is only necessary for new types not external implementations of an existing type.

If necessary, we could have the schemas provider do the filtering again, but that would be to on trim the contents relative to what is active (installed), with the base schema indicating what has been qualified.

We can visit this once we no longer have our two out-of-the-box processors unconditionally available. However, I believe the enum itself (prior to runtime) should be a reflection of support/qualification.

"uihints": {
"field_type": "dropdown",
"category": "Runtime"
Expand Down Expand Up @@ -86,8 +79,8 @@
}
}
},
"required": ["runtime", "paths"]
"required": ["runtime_type", "paths"]
}
},
"required": ["schema_name", "display_name", "version", "metadata"]
"required": ["schema_name", "display_name", "metadata"]
}
19 changes: 6 additions & 13 deletions elyra/metadata/schemas/local-file-catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
"type": "string",
"minLength": 1
},
"version": {
"title": "Version",
"description": "The version associated with this instance",
"type": "integer",
"const": 1
},
"metadata": {
"description": "Additional data specific to this metadata",
"type": "object",
Expand All @@ -39,12 +33,11 @@
"description": "Description of this Component Catalog",
"type": "string"
},
"runtime": {
"title": "Runtime",
"description": "The runtime associated with this Component Catalog",
"runtime_type": {
"title": "Runtime Type",
"description": "The type of runtime associated with this Component Catalog",
"type": "string",
"$comment": "This enum is dynamically generated to contain the available runtime values.",
"enum": ["{currently-configured-runtimes}"],
"enum": ["KUBEFLOW_PIPELINES", "APACHE_AIRFLOW"],
"uihints": {
"field_type": "dropdown",
"category": "Runtime"
Expand Down Expand Up @@ -84,8 +77,8 @@
}
}
},
"required": ["runtime", "paths"]
"required": ["runtime_type", "paths"]
}
},
"required": ["schema_name", "display_name", "version", "metadata"]
"required": ["schema_name", "display_name", "metadata"]
}
19 changes: 6 additions & 13 deletions elyra/metadata/schemas/url-catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
"type": "string",
"minLength": 1
},
"version": {
"title": "Version",
"description": "The version associated with this instance",
"type": "integer",
"const": 1
},
"metadata": {
"description": "Additional data specific to this metadata",
"type": "object",
Expand All @@ -39,12 +33,11 @@
"description": "Description of this Component Catalog",
"type": "string"
},
"runtime": {
"title": "Runtime",
"description": "The runtime associated with this Component Catalog",
"runtime_type": {
"title": "Runtime Type",
"description": "The type of runtime associated with this Component Catalog",
"type": "string",
"$comment": "This enum is dynamically generated to contain the available runtime values.",
"enum": ["{currently-configured-runtimes}"],
"enum": ["KUBEFLOW_PIPELINES", "APACHE_AIRFLOW"],
"uihints": {
"field_type": "dropdown",
"category": "Runtime"
Expand Down Expand Up @@ -77,8 +70,8 @@
}
}
},
"required": ["runtime", "paths"]
"required": ["runtime_type", "paths"]
}
},
"required": ["schema_name", "display_name", "version", "metadata"]
"required": ["schema_name", "display_name", "metadata"]
}
30 changes: 10 additions & 20 deletions elyra/metadata/schemaspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

from typing import Dict

import entrypoints

from elyra.metadata.schema import Schemaspace


Expand Down Expand Up @@ -67,27 +65,19 @@ def __init__(self, *args, **kwargs):
display_name=ComponentRegistries.COMPONENT_REGISTRIES_SCHEMASPACE_DISPLAY_NAME,
description="Schemaspace for instances of Elyra component registries configurations")

# get set of registered runtimes
self._runtime_processor_names = set()
for processor in entrypoints.get_group_all('elyra.pipeline.processors'):
# load the names of the runtime processors (skip 'local')
if processor.name == 'local':
continue
self._runtime_processor_names.add(processor.name)

def filter_schema(self, schema: Dict) -> Dict:
"""Replace contents of Runtimes value with set of runtimes if using templated value."""

# Component-registry requires that `runtime` be a defined property so ensure its existence.
instance_properties = schema.get('properties', {}).get('metadata', {}).get('properties', {})
runtime = instance_properties.get('runtime')
if not runtime:
raise ValueError(f"{ComponentRegistries.COMPONENT_REGISTRIES_SCHEMASPACE_DISPLAY_NAME} schemas are "
f"required to define a 'runtime' (string-valued) property and schema "
f"\'{schema.get('name')}\' does not define 'runtime'.")

if runtime.get('enum') == ["{currently-configured-runtimes}"]:
runtime['enum'] = list(self._runtime_processor_names)
# Component-registry requires that `runtime_type` be a defined property so ensure its existence.
# Since schema 'component-registry' is deprecated, skip its check.
is_deprecated = schema.get('deprecated', False)
if not is_deprecated: # Skip deprecated schemas
instance_properties = schema.get('properties', {}).get('metadata', {}).get('properties', {})
runtime_type = instance_properties.get('runtime_type')
if not runtime_type:
raise ValueError(f"{ComponentRegistries.COMPONENT_REGISTRIES_SCHEMASPACE_DISPLAY_NAME} schemas are "
f"required to define a 'runtime_type' (string-valued) property and schema "
f"\'{schema.get('name')}\' does not define 'runtime_type'.")

# Component catalogs should have an associated 'metadata' class name
# If none is provided, use the ComponentCatalogMetadata class, which implements
Expand Down
7 changes: 4 additions & 3 deletions elyra/pipeline/airflow/component_parser_airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
from elyra.pipeline.component import Component
from elyra.pipeline.component import ComponentParameter
from elyra.pipeline.component import ComponentParser
from elyra.pipeline.runtime_type import RuntimeProcessorType


class AirflowComponentParser(ComponentParser):
_component_platform = "airflow"
_file_types = [".py"]
_component_platform: RuntimeProcessorType = RuntimeProcessorType.APACHE_AIRFLOW
_file_types: List[str] = [".py"]

def parse(self, registry_entry: SimpleNamespace) -> Optional[List[Component]]:
components: List[Component] = list()
Expand All @@ -51,7 +52,7 @@ def parse(self, registry_entry: SimpleNamespace) -> Optional[List[Component]]:
catalog_type=registry_entry.catalog_type,
source_identifier=registry_entry.component_identifier,
definition=self.get_class_def_as_string(component_content),
runtime=self.component_platform,
runtime_type=self.component_platform.name,
categories=registry_entry.categories,
properties=component_properties
)
Expand Down
15 changes: 5 additions & 10 deletions elyra/pipeline/airflow/processor_airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
from elyra.pipeline.processor import PipelineProcessor
from elyra.pipeline.processor import PipelineProcessorResponse
from elyra.pipeline.processor import RuntimePipelineProcessor
from elyra.pipeline.runtime_type import RuntimeProcessorType
from elyra.util.git import GithubClient
from elyra.util.path import get_absolute_path


class AirflowPipelineProcessor(RuntimePipelineProcessor):
_type = 'airflow'
_type = RuntimeProcessorType.APACHE_AIRFLOW
_name = 'airflow'

# Provide users with the ability to identify a writable directory in the
# running container where the notebook | script is executed. The location
Expand Down Expand Up @@ -73,10 +75,6 @@ class AirflowPipelineProcessor(RuntimePipelineProcessor):
# Contains mappings from class to import statement for each available Airflow operator
class_import_map = {}

@property
def type(self):
return self._type

def __init__(self, root_dir, **kwargs):
super().__init__(root_dir, component_parser=AirflowComponentParser(), **kwargs)
if not self.class_import_map: # Only need to load once
Expand Down Expand Up @@ -432,16 +430,13 @@ def _process_list_value(self, value: str) -> Union[List, str]:

class AirflowPipelineProcessorResponse(PipelineProcessorResponse):

_type = 'airflow'
_type = RuntimeProcessorType.APACHE_AIRFLOW
_name = 'airflow'

def __init__(self, git_url, run_url, object_storage_url, object_storage_path):
super().__init__(run_url, object_storage_url, object_storage_path)
self.git_url = git_url

@property
def type(self):
return self._type

def to_json(self):
response = super().to_json()
response['git_url'] = self.git_url
Expand Down
17 changes: 10 additions & 7 deletions elyra/pipeline/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

from traitlets.config import LoggingConfigurable

from elyra.pipeline.runtime_type import RuntimeProcessorType


class ComponentParameter(object):
"""
Expand Down Expand Up @@ -122,7 +124,7 @@ def __init__(self,
catalog_type: str,
source_identifier: Any,
definition: Optional[str] = None,
runtime: Optional[str] = None,
runtime_type: Optional[RuntimeProcessorType] = None,
op: Optional[str] = None,
categories: Optional[List[str]] = None,
properties: Optional[List[ComponentParameter]] = None,
Expand All @@ -136,7 +138,7 @@ def __init__(self,
location; one of ['url', filename', 'directory]
:param source_identifier: Source information to help locate the component definition
:param definition: The content of the specification file for this component
:param runtime: The runtime of the component (e.g. KFP or Airflow)
:param runtime_type: The runtime type of the component (e.g. KUBEFLOW_PIPELINES, APACHE_AIRFLOW, etc.)
:param op: The operation name of the component; used by generic components in rendering the palette
:param categories: A list of categories that this component belongs to; used to organize component
in the palette
Expand All @@ -156,7 +158,7 @@ def __init__(self,
self._source_identifier = source_identifier

self._definition = definition
self._runtime = runtime
self._runtime_type = runtime_type
self._op = op
self._categories = categories or []
self._properties = properties
Expand Down Expand Up @@ -209,8 +211,8 @@ def definition(self) -> str:
return self._definition

@property
def runtime(self) -> Optional[str]:
return self._runtime
def runtime_type(self) -> Optional[RuntimeProcessorType]:
return self._runtime_type

@property
def op(self) -> Optional[str]:
Expand Down Expand Up @@ -244,10 +246,11 @@ def _log_warning(msg: str, logger: Optional[Logger] = None):


class ComponentParser(LoggingConfigurable): # ABC
_component_platform = None
_component_platform: RuntimeProcessorType = None
_file_types: List[str] = None

@property
def component_platform(self) -> str:
def component_platform(self) -> RuntimeProcessorType:
return self._component_platform

@property
Expand Down