Skip to content

Commit 10a69de

Browse files
committed
Deprecate KFP v1 support
1 parent 4012ecb commit 10a69de

File tree

17 files changed

+54
-1595
lines changed

17 files changed

+54
-1595
lines changed

build/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ sh_binary(
2525
"//tfx/extensions/experimental/kfp_compatibility/proto:kfp_component_spec_pb2.py",
2626
"//tfx/extensions/google_cloud_big_query/experimental/elwc_example_gen/proto:elwc_config_pb2.py",
2727
"//tfx/orchestration/experimental/core:component_generated_alert_pb2.py",
28-
"//tfx/orchestration/kubeflow/proto:kubeflow_pb2.py",
2928
"//tfx/proto:bulk_inferrer_pb2.py",
3029
"//tfx/proto:distribution_validator_pb2.py",
3130
"//tfx/proto:evaluator_pb2.py",

tfx/dependencies.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ def make_pipeline_sdk_required_install_packages():
6969
# TODO(b/176812386): Deprecate usage of jinja2 for placeholders.
7070
'jinja2>=2.7.3,<4',
7171
# typing-extensions allows consistent & future-proof interface for typing.
72-
# Since kfp<2 uses typing-extensions<4, lower bound is the latest 3.x, and
73-
# upper bound is <5 as the semver started from 4.0 according to their doc.
74-
'typing-extensions>=3.10.0.2,<5',
72+
# Upper bound is <5 as the semver started from 4.0 according to their doc.
73+
'typing-extensions<5',
7574
]
7675

7776

@@ -87,7 +86,7 @@ def make_required_install_packages():
8786
'google-cloud-bigquery>=3,<4',
8887
'grpcio>=1.28.1,<2',
8988
'keras-tuner>=1.0.4,<2,!=1.4.0,!=1.4.1',
90-
'kubernetes>=10.0.1,<13',
89+
'kubernetes>=10.0.1,<27',
9190
'numpy>=1.16,<2',
9291
'pyarrow>=10,<11',
9392
# TODO: b/358471141 - Orjson 3.10.7 breaks TFX OSS tests.
@@ -146,27 +145,29 @@ def make_extra_packages_airflow():
146145
def make_extra_packages_kfp():
147146
"""Prepare extra packages needed for Kubeflow Pipelines orchestrator."""
148147
return [
149-
# TODO(b/304892416): Migrate from KFP SDK v1 to v2.
150-
'kfp>=1.8.14,<2',
151-
'kfp-pipeline-spec>0.1.13,<0.2',
148+
'kfp>=2',
149+
'kfp-pipeline-spec>=0.2.2',
152150
]
153151

154152

155153
def make_extra_packages_test():
156154
"""Prepare extra packages needed for running unit tests."""
157155
# Note: It is okay to pin packages to exact versions in this list to minimize
158156
# conflicts.
159-
return make_extra_packages_airflow() + make_extra_packages_kfp() + [
160-
'pytest>=5,<7',
161-
]
157+
return (
158+
make_extra_packages_airflow()
159+
+ make_extra_packages_kfp()
160+
+ [
161+
'pytest>=5,<7',
162+
]
163+
)
162164

163165

164166
def make_extra_packages_docker_image():
165167
# Packages needed for tfx docker image.
166168
return [
167-
# TODO(b/304892416): Migrate from KFP SDK v1 to v2.
168-
'kfp>=1.8.14,<2',
169-
'kfp-pipeline-spec>0.1.13,<0.2',
169+
'kfp>=2',
170+
'kfp-pipeline-spec>=0.3.0',
170171
'mmh>=2.2,<3',
171172
'python-snappy>=0.5,<0.6',
172173
# Required for tfx/examples/penguin/penguin_utils_cloud_tuner.py
@@ -194,10 +195,12 @@ def make_extra_packages_tf_ranking():
194195
# Packages needed for tf-ranking which is used in tfx/examples/ranking.
195196
return [
196197
'tensorflow-ranking>=0.5,<0.6',
197-
'struct2tensor' + select_constraint(
198+
'struct2tensor'
199+
+ select_constraint(
198200
default='>=0.46.0,<0.47.0',
199201
nightly='>=0.47.0.dev',
200-
git_master='@git+https://github.com/google/struct2tensor@master'),
202+
git_master='@git+https://github.com/google/struct2tensor@master',
203+
),
201204
]
202205

203206

tfx/examples/penguin/penguin_pipeline_kubeflow.py

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -501,33 +501,28 @@ def main():
501501
else:
502502
beam_pipeline_args = _beam_pipeline_args_by_runner['DirectRunner']
503503

504-
if use_vertex:
505-
dag_runner = tfx.orchestration.experimental.KubeflowV2DagRunner(
506-
config=tfx.orchestration.experimental.KubeflowV2DagRunnerConfig(),
507-
output_filename=_pipeline_definition_file)
508-
else:
509-
dag_runner = tfx.orchestration.experimental.KubeflowDagRunner(
510-
config=tfx.orchestration.experimental.KubeflowDagRunnerConfig(
511-
kubeflow_metadata_config=tfx.orchestration.experimental
512-
.get_default_kubeflow_metadata_config()))
513-
514-
dag_runner.run(
515-
create_pipeline(
516-
pipeline_name=_pipeline_name,
517-
pipeline_root=_pipeline_root,
518-
data_root=_data_root,
519-
module_file=_module_file,
520-
enable_tuning=False,
521-
enable_cache=True,
522-
user_provided_schema_path=_user_provided_schema,
523-
ai_platform_training_args=_ai_platform_training_args,
524-
ai_platform_serving_args=_ai_platform_serving_args,
525-
beam_pipeline_args=beam_pipeline_args,
526-
use_cloud_component=use_cloud_component,
527-
use_aip=use_aip,
528-
use_vertex=use_vertex,
529-
serving_model_dir=_serving_model_dir,
530-
))
504+
dag_runner = tfx.orchestration.experimental.KubeflowV2DagRunner(
505+
config=tfx.orchestration.experimental.KubeflowV2DagRunnerConfig(),
506+
output_filename=_pipeline_definition_file,
507+
)
508+
dag_runner.run(
509+
create_pipeline(
510+
pipeline_name=_pipeline_name,
511+
pipeline_root=_pipeline_root,
512+
data_root=_data_root,
513+
module_file=_module_file,
514+
enable_tuning=False,
515+
enable_cache=True,
516+
user_provided_schema_path=_user_provided_schema,
517+
ai_platform_training_args=_ai_platform_training_args,
518+
ai_platform_serving_args=_ai_platform_serving_args,
519+
beam_pipeline_args=beam_pipeline_args,
520+
use_cloud_component=use_cloud_component,
521+
use_aip=use_aip,
522+
use_vertex=use_vertex,
523+
serving_model_dir=_serving_model_dir,
524+
)
525+
)
531526

532527

533528
# To compile the pipeline:

tfx/examples/penguin/penguin_pipeline_kubeflow_test.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,16 @@ def testPenguinPipelineConstructionAndDefinitionFileExists(
6464
serving_model_dir=penguin_pipeline_kubeflow._serving_model_dir)
6565
self.assertLen(kubeflow_pipeline.components, 9)
6666

67-
if use_vertex:
68-
v2_dag_runner = orchestration.experimental.KubeflowV2DagRunner(
69-
config=orchestration.experimental.KubeflowV2DagRunnerConfig(),
70-
output_dir=self.tmp_dir,
71-
output_filename=penguin_pipeline_kubeflow._pipeline_definition_file)
72-
v2_dag_runner.run(kubeflow_pipeline)
73-
file_path = os.path.join(
74-
self.tmp_dir, penguin_pipeline_kubeflow._pipeline_definition_file)
75-
self.assertTrue(fileio.exists(file_path))
76-
else:
77-
v1_dag_runner = orchestration.experimental.KubeflowDagRunner(
78-
config=orchestration.experimental.KubeflowDagRunnerConfig(
79-
kubeflow_metadata_config=orchestration.experimental
80-
.get_default_kubeflow_metadata_config()))
81-
v1_dag_runner.run(kubeflow_pipeline)
82-
file_path = os.path.join(self.tmp_dir, 'penguin-kubeflow.tar.gz')
83-
self.assertTrue(fileio.exists(file_path))
84-
67+
v2_dag_runner = orchestration.experimental.KubeflowV2DagRunner(
68+
config=orchestration.experimental.KubeflowV2DagRunnerConfig(),
69+
output_dir=self.tmp_dir,
70+
output_filename=penguin_pipeline_kubeflow._pipeline_definition_file,
71+
)
72+
v2_dag_runner.run(kubeflow_pipeline)
73+
file_path = os.path.join(
74+
self.tmp_dir, penguin_pipeline_kubeflow._pipeline_definition_file
75+
)
76+
self.assertTrue(fileio.exists(file_path))
8577

8678
if __name__ == '__main__':
8779
tf.test.main()

tfx/experimental/templates/taxi/kubeflow_runner.py

Lines changed: 0 additions & 100 deletions
This file was deleted.

tfx/orchestration/data_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def component_run_context_name(self) -> str:
145145
class RuntimeParameter(json_utils.Jsonable):
146146
"""Runtime parameter.
147147
148-
Currently only supported on KubeflowDagRunner.
148+
Currently only supported on KubeflowV2DagRunner.
149149
150150
For protos, use text type RuntimeParameter, which holds the proto json
151151
string, e.g., `'{"num_steps": 5}'` for TrainArgs proto.

0 commit comments

Comments
 (0)