fix(sdk): fix GCPC break in KFP SDK (#9791)
This commit is contained in:
parent
ae804f471c
commit
540294aedb
|
@ -27,6 +27,10 @@ __all__ = [
|
|||
from kfp.components.load_yaml_utilities import load_component_from_file
|
||||
from kfp.components.load_yaml_utilities import load_component_from_text
|
||||
from kfp.components.load_yaml_utilities import load_component_from_url
|
||||
# keep this for backward compatibility with user code "from kfp.components import placholders" and similar
|
||||
from kfp.dsl import base_component # noqa: keep unused import
|
||||
from kfp.dsl import placeholders # noqa: keep unused import
|
||||
#
|
||||
from kfp.dsl.base_component import BaseComponent
|
||||
from kfp.dsl.container_component_class import ContainerComponent
|
||||
from kfp.dsl.python_component import PythonComponent
|
||||
|
|
|
@ -21,6 +21,6 @@ warnings.warn(
|
|||
category=DeprecationWarning,
|
||||
stacklevel=2)
|
||||
|
||||
from kfp import compiler
|
||||
from kfp import components
|
||||
from kfp import dsl
|
||||
from kfp import compiler # noqa: keep unused import
|
||||
from kfp import components # noqa: keep unused import
|
||||
from kfp import dsl # noqa: keep unused import
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# Copyright 2023 The Kubeflow Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""Test running all GCPC modules."""
|
||||
import importlib
|
||||
import pkgutil
|
||||
import unittest
|
||||
|
||||
|
||||
def run_all_modules(package_name: str) -> None:
|
||||
package = importlib.import_module(package_name)
|
||||
for _, module_name, ispkg in pkgutil.walk_packages(package.__path__):
|
||||
# use dots to avoid false positives on packages with google in name
|
||||
# and train test split packages
|
||||
if '.test' in package_name:
|
||||
continue
|
||||
if ispkg:
|
||||
run_all_modules(f'{package_name}.{module_name}')
|
||||
else:
|
||||
importlib.import_module(f'{package_name}.{module_name}')
|
||||
print(f'Successfully ran: {package_name}')
|
||||
|
||||
|
||||
class TestRunAllGCPCModules(unittest.TestCase):
|
||||
|
||||
def test_run_all_modules(self):
|
||||
run_all_modules('google_cloud_pipeline_components.preview')
|
||||
run_all_modules('google_cloud_pipeline_components.v1')
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash -ex
|
||||
# Copyright 2023 Kubeflow Pipelines contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
source_root=$(pwd)
|
||||
|
||||
pip install --upgrade pip
|
||||
source $source_root/sdk/python/install_from_source.sh
|
||||
pip install components/google-cloud
|
||||
pip install $(grep 'pytest==' sdk/python/requirements-dev.txt)
|
||||
|
||||
pytest test/gcpc-tests/run_all_gcpc_modules.py
|
Loading…
Reference in New Issue