@@ -686,6 +686,7 @@ def run_pipeline(
686
686
version_id : Optional [str ] = None ,
687
687
pipeline_root : Optional [str ] = None ,
688
688
enable_caching : Optional [bool ] = None ,
689
+ cache_key : Optional [str ] = '' ,
689
690
service_account : Optional [str ] = None ,
690
691
) -> kfp_server_api .V2beta1Run :
691
692
"""Runs a specified pipeline.
@@ -709,6 +710,8 @@ def run_pipeline(
709
710
is ``True`` for all tasks by default. If set, the
710
711
setting applies to all tasks in the pipeline (overrides the
711
712
compile time settings).
713
+ cache_key (optional): Customized cache key for this task.
714
+ If set, the cache_key will be used as the key for the task's cache.
712
715
service_account: Specifies which Kubernetes service
713
716
account to use for this run.
714
717
@@ -721,6 +724,7 @@ def run_pipeline(
721
724
pipeline_id = pipeline_id ,
722
725
version_id = version_id ,
723
726
enable_caching = enable_caching ,
727
+ cache_key = cache_key ,
724
728
pipeline_root = pipeline_root ,
725
729
)
726
730
@@ -806,6 +810,7 @@ def create_recurring_run(
806
810
enabled : bool = True ,
807
811
pipeline_root : Optional [str ] = None ,
808
812
enable_caching : Optional [bool ] = None ,
813
+ cache_key : Optional [str ] = '' ,
809
814
service_account : Optional [str ] = None ,
810
815
) -> kfp_server_api .V2beta1RecurringRun :
811
816
"""Creates a recurring run.
@@ -850,6 +855,8 @@ def create_recurring_run(
850
855
different caching options for individual tasks. If set, the
851
856
setting applies to all tasks in the pipeline (overrides the
852
857
compile time settings).
858
+ cache_key (optional): Customized cache key for this task.
859
+ If set, the cache_key will be used as the key for the task's cache.
853
860
service_account: Specifies which Kubernetes service
854
861
account this recurring run uses.
855
862
Returns:
@@ -862,6 +869,7 @@ def create_recurring_run(
862
869
pipeline_id = pipeline_id ,
863
870
version_id = version_id ,
864
871
enable_caching = enable_caching ,
872
+ cache_key = cache_key ,
865
873
pipeline_root = pipeline_root ,
866
874
)
867
875
@@ -908,6 +916,7 @@ def _create_job_config(
908
916
pipeline_id : Optional [str ],
909
917
version_id : Optional [str ],
910
918
enable_caching : Optional [bool ],
919
+ cache_key : Optional [str ],
911
920
pipeline_root : Optional [str ],
912
921
) -> _JobConfig :
913
922
"""Creates a JobConfig with spec and resource_references.
@@ -928,6 +937,8 @@ def _create_job_config(
928
937
different caching options for individual tasks. If set, the
929
938
setting applies to all tasks in the pipeline (overrides the
930
939
compile time settings).
940
+ cache_key (optional): Customized cache key for this task.
941
+ If set, the cache_key will be used as the key for the task's cache.
931
942
pipeline_root: Root path of the pipeline outputs.
932
943
933
944
Returns:
@@ -956,7 +967,7 @@ def _create_job_config(
956
967
# settings.
957
968
if enable_caching is not None :
958
969
_override_caching_options (pipeline_doc .pipeline_spec ,
959
- enable_caching )
970
+ enable_caching , cache_key )
960
971
pipeline_spec = pipeline_doc .to_dict ()
961
972
962
973
pipeline_version_reference = None
@@ -983,6 +994,7 @@ def create_run_from_pipeline_func(
983
994
namespace : Optional [str ] = None ,
984
995
pipeline_root : Optional [str ] = None ,
985
996
enable_caching : Optional [bool ] = None ,
997
+ cache_key : Optional [str ] = '' ,
986
998
service_account : Optional [str ] = None ,
987
999
experiment_id : Optional [str ] = None ,
988
1000
) -> RunPipelineResult :
@@ -1004,6 +1016,8 @@ def create_run_from_pipeline_func(
1004
1016
different caching options for individual tasks. If set, the
1005
1017
setting applies to all tasks in the pipeline (overrides the
1006
1018
compile time settings).
1019
+ cache_key (optional): Customized cache key for this task.
1020
+ If set, the cache_key will be used as the key for the task's cache.
1007
1021
service_account: Specifies which Kubernetes service
1008
1022
account to use for this run.
1009
1023
experiment_id: ID of the experiment to add the run to. You cannot specify both experiment_id and experiment_name.
@@ -1032,6 +1046,7 @@ def create_run_from_pipeline_func(
1032
1046
namespace = namespace ,
1033
1047
pipeline_root = pipeline_root ,
1034
1048
enable_caching = enable_caching ,
1049
+ cache_key = cache_key ,
1035
1050
service_account = service_account ,
1036
1051
)
1037
1052
@@ -1044,6 +1059,7 @@ def create_run_from_pipeline_package(
1044
1059
namespace : Optional [str ] = None ,
1045
1060
pipeline_root : Optional [str ] = None ,
1046
1061
enable_caching : Optional [bool ] = None ,
1062
+ cache_key : Optional [str ] = '' ,
1047
1063
service_account : Optional [str ] = None ,
1048
1064
experiment_id : Optional [str ] = None ,
1049
1065
) -> RunPipelineResult :
@@ -1065,6 +1081,8 @@ def create_run_from_pipeline_package(
1065
1081
different caching options for individual tasks. If set, the
1066
1082
setting applies to all tasks in the pipeline (overrides the
1067
1083
compile time settings).
1084
+ cache_key (optional): Customized cache key for this task.
1085
+ If set, the cache_key will be used as the key for the task's cache.
1068
1086
service_account: Specifies which Kubernetes service
1069
1087
account to use for this run.
1070
1088
experiment_id: ID of the experiment to add the run to. You cannot specify both experiment_id and experiment_name.
@@ -1105,6 +1123,7 @@ def create_run_from_pipeline_package(
1105
1123
params = arguments ,
1106
1124
pipeline_root = pipeline_root ,
1107
1125
enable_caching = enable_caching ,
1126
+ cache_key = cache_key ,
1108
1127
service_account = service_account ,
1109
1128
)
1110
1129
return RunPipelineResult (self , run_info )
@@ -1681,6 +1700,7 @@ def _safe_load_yaml(stream: TextIO) -> _PipelineDoc:
1681
1700
def _override_caching_options (
1682
1701
pipeline_spec : pipeline_spec_pb2 .PipelineSpec ,
1683
1702
enable_caching : bool ,
1703
+ cache_key : str = '' ,
1684
1704
) -> None :
1685
1705
"""Overrides caching options.
1686
1706
@@ -1690,3 +1710,4 @@ def _override_caching_options(
1690
1710
"""
1691
1711
for _ , task_spec in pipeline_spec .root .dag .tasks .items ():
1692
1712
task_spec .caching_options .enable_cache = enable_caching
1713
+ task_spec .caching_options .cache_key = cache_key
0 commit comments