Skip to content

Commit

Permalink
fix(sdk): block dsl.importer usage in KFP OSS. Fixes: #6323 (#6330)
Browse files Browse the repository at this point in the history
* block dsl.importer in KFP OSS

* address cr comments
  • Loading branch information
chensun authored Aug 16, 2021
1 parent 5e597b1 commit 434e5c3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
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 Kubeflow Pipelines open source yet.')

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 Kubeflow Pipelines open source 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 Kubeflow Pipelines open source yet.',
):
kfp.compiler.Compiler().compile(
pipeline_func=my_pipeline, package_path='result.json')

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

0 comments on commit 434e5c3

Please sign in to comment.