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

fix(sdk): block dsl.importer usage in KFP OSS. Fixes: #6323 #6330

Merged
merged 2 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sdk/python/kfp/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,10 @@ def _create_dag_templates(self, pipeline, op_transformers=None, op_to_templates_
templates.append(template)

for op in pipeline.ops.values():
if hasattr(op, 'importer_spec'):
raise NotImplementedError(
'dsl.importer is not supported for KFP OSS yet.')
chensun marked this conversation as resolved.
Show resolved Hide resolved

if self._mode == dsl.PipelineExecutionMode.V2_COMPATIBLE:
v2_compat.update_op(op,
pipeline_name=self._pipeline_name_param,
Expand Down
14 changes: 14 additions & 0 deletions sdk/python/kfp/compiler/v2_compatible_compiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,19 @@ def my_pipeline():
compiler.Compiler(mode=dsl.PipelineExecutionMode.V2_COMPATIBLE).compile(
pipeline_func=my_pipeline, package_path='result.json')

def test_use_importer_should_error(self):

@dsl.pipeline(name='test-pipeline')
def my_pipeline():
dsl.importer(artifact_uri='dummy', artifact_class=dsl.io_types.Artifact)

with self.assertRaisesRegex(
NotImplementedError,
'dsl.importer is not supported for KFP OSS yet.',
):
compiler.Compiler(mode=dsl.PipelineExecutionMode.V2_COMPATIBLE).compile(
pipeline_func=my_pipeline, package_path='result.json')


if __name__ == '__main__':
unittest.main()
13 changes: 13 additions & 0 deletions sdk/python/tests/compiler/compiler_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,5 +1275,18 @@ def remove_metadata(yaml) -> None:
# compare
self.assertEqual(pipeline_yaml_arg, pipeline_yaml_kwarg)

def test_use_importer_should_error(self):

@dsl.pipeline(name='test-pipeline')
def my_pipeline():
dsl.importer(artifact_uri='dummy', artifact_class=dsl.io_types.Artifact)

with self.assertRaisesRegex(
NotImplementedError,
'dsl.importer is not supported for KFP OSS yet.',
):
kfp.compiler.Compiler().compile(
pipeline_func=my_pipeline, package_path='result.json')

if __name__ == '__main__':
unittest.main()