From dc757a47bfeede4e9c9bbe3eebb55d43b1dd5f05 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Oliveira" Date: Wed, 25 Sep 2024 12:07:20 -0300 Subject: [PATCH] Enable TTL configuration --- api/v2alpha1/go/cachekey/cache_key.pb.go | 6 +- .../go/pipelinespec/pipeline_spec.pb.go | 174 ++++++++++-------- api/v2alpha1/pipeline_spec.proto | 2 + sdk/python/kfp/cli/cli.py | 2 +- .../kfp/compiler/pipeline_spec_builder.py | 7 +- sdk/python/kfp/dsl/component_decorator.py | 6 +- sdk/python/kfp/dsl/component_factory.py | 6 +- sdk/python/kfp/dsl/graph_component.py | 2 + sdk/python/kfp/dsl/pipeline_context.py | 6 +- 9 files changed, 126 insertions(+), 85 deletions(-) diff --git a/api/v2alpha1/go/cachekey/cache_key.pb.go b/api/v2alpha1/go/cachekey/cache_key.pb.go index eb29fd917c7b..1d6fa474c0ed 100644 --- a/api/v2alpha1/go/cachekey/cache_key.pb.go +++ b/api/v2alpha1/go/cachekey/cache_key.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 +// protoc-gen-go v1.33.0 // protoc v3.17.3 // source: cache_key.proto @@ -42,7 +42,7 @@ type CacheKey struct { unknownFields protoimpl.UnknownFields InputArtifactNames map[string]*ArtifactNameList `protobuf:"bytes,1,rep,name=inputArtifactNames,proto3" json:"inputArtifactNames,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in cache_key.proto. InputParameters map[string]*pipelinespec.Value `protobuf:"bytes,2,rep,name=inputParameters,proto3" json:"inputParameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` OutputArtifactsSpec map[string]*pipelinespec.RuntimeArtifact `protobuf:"bytes,3,rep,name=outputArtifactsSpec,proto3" json:"outputArtifactsSpec,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` OutputParametersSpec map[string]string `protobuf:"bytes,4,rep,name=outputParametersSpec,proto3" json:"outputParametersSpec,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -89,7 +89,7 @@ func (x *CacheKey) GetInputArtifactNames() map[string]*ArtifactNameList { return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in cache_key.proto. func (x *CacheKey) GetInputParameters() map[string]*pipelinespec.Value { if x != nil { return x.InputParameters diff --git a/api/v2alpha1/go/pipelinespec/pipeline_spec.pb.go b/api/v2alpha1/go/pipelinespec/pipeline_spec.pb.go index b5d942ae87f1..309f55078836 100644 --- a/api/v2alpha1/go/pipelinespec/pipeline_spec.pb.go +++ b/api/v2alpha1/go/pipelinespec/pipeline_spec.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 +// protoc-gen-go v1.33.0 // protoc v3.17.3 // source: pipeline_spec.proto @@ -26,7 +26,7 @@ const ( // The primitive types. // Deprecated. Use [ParameterType.ParameterTypeEnum][] instead. // -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. type PrimitiveType_PrimitiveTypeEnum int32 const ( @@ -521,6 +521,7 @@ type ComponentSpec struct { // Either a DAG or a single execution. // // Types that are assignable to Implementation: + // // *ComponentSpec_Dag // *ComponentSpec_ExecutorLabel Implementation isComponentSpec_Implementation `protobuf_oneof:"implementation"` @@ -968,7 +969,7 @@ func (x *TaskOutputsSpec) GetArtifacts() map[string]*TaskOutputsSpec_OutputArtif // Represent primitive types. The wrapper is needed to give a namespace of // enum value so we don't need add `PRIMITIVE_TYPE_` prefix of each enum value. // -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. type PrimitiveType struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1071,11 +1072,11 @@ type PipelineTaskSpec struct { // values of input artifact or parameter. The current task will become the // parent of all the fan-out tasks. The output of the current task follows // the following conventions: - // * Output artifacts with the same name of each iteration will be merged - // into one output artifact channel of the parent iterator task. - // * Output parameters with the same name of each iteration will be merged - // into a string output parameter with the same name with content being a - // JSON array. + // - Output artifacts with the same name of each iteration will be merged + // into one output artifact channel of the parent iterator task. + // - Output parameters with the same name of each iteration will be merged + // into a string output parameter with the same name with content being a + // JSON array. // // For example, if an iterator starts two sub-tasks (t1 and t2) with the // following outputs. @@ -1088,6 +1089,7 @@ type PipelineTaskSpec struct { // parent_task.outputs.aritfacts = { 'a': [a1, a2] } // // Types that are assignable to Iterator: + // // *PipelineTaskSpec_ArtifactIterator // *PipelineTaskSpec_ParameterIterator Iterator isPipelineTaskSpec_Iterator `protobuf_oneof:"iterator"` @@ -1471,6 +1473,7 @@ type ArtifactTypeSchema struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *ArtifactTypeSchema_SchemaTitle // *ArtifactTypeSchema_SchemaUri // *ArtifactTypeSchema_InstanceSchema @@ -1526,7 +1529,7 @@ func (x *ArtifactTypeSchema) GetSchemaTitle() string { return "" } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *ArtifactTypeSchema) GetSchemaUri() string { if x, ok := x.GetKind().(*ArtifactTypeSchema_SchemaUri); ok { return x.SchemaUri @@ -1569,7 +1572,7 @@ type ArtifactTypeSchema_SchemaUri struct { // Deprecated. Use [PipelineArtifactTypeSchema.schema_title][] or // [PipelineArtifactTypeSchema.instance_schema][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. SchemaUri string `protobuf:"bytes,2,opt,name=schema_uri,json=schemaUri,proto3,oneof"` } @@ -1644,6 +1647,7 @@ type ValueOrRuntimeParameter struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Value: + // // *ValueOrRuntimeParameter_ConstantValue // *ValueOrRuntimeParameter_RuntimeParameter // *ValueOrRuntimeParameter_Constant @@ -1689,7 +1693,7 @@ func (m *ValueOrRuntimeParameter) GetValue() isValueOrRuntimeParameter_Value { return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *ValueOrRuntimeParameter) GetConstantValue() *Value { if x, ok := x.GetValue().(*ValueOrRuntimeParameter_ConstantValue); ok { return x.ConstantValue @@ -1719,7 +1723,7 @@ type ValueOrRuntimeParameter_ConstantValue struct { // Constant value which is determined in compile time. // Deprecated. Use [ValueOrRuntimeParameter.constant][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. ConstantValue *Value `protobuf:"bytes,1,opt,name=constant_value,json=constantValue,proto3,oneof"` } @@ -1796,6 +1800,7 @@ type Value struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Value: + // // *Value_IntValue // *Value_DoubleValue // *Value_StringValue @@ -1902,12 +1907,12 @@ type RuntimeArtifact struct { // The properties of the artifact. // Deprecated. Use [RuntimeArtifact.metadata][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. Properties map[string]*Value `protobuf:"bytes,4,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // The custom properties of the artifact. // Deprecated. Use [RuntimeArtifact.metadata][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. CustomProperties map[string]*Value `protobuf:"bytes,5,rep,name=custom_properties,json=customProperties,proto3" json:"custom_properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Properties of the Artifact. Metadata *structpb.Struct `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"` @@ -1966,7 +1971,7 @@ func (x *RuntimeArtifact) GetUri() string { return "" } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *RuntimeArtifact) GetProperties() map[string]*Value { if x != nil { return x.Properties @@ -1974,7 +1979,7 @@ func (x *RuntimeArtifact) GetProperties() map[string]*Value { return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *RuntimeArtifact) GetCustomProperties() map[string]*Value { if x != nil { return x.CustomProperties @@ -2130,7 +2135,7 @@ type ExecutorOutput struct { // The values for output parameters. // Deprecated. Use [ExecutorOutput.parameter_values][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. Parameters map[string]*Value `protobuf:"bytes,1,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // The updated metadata for output artifact. Artifacts map[string]*ArtifactList `protobuf:"bytes,2,rep,name=artifacts,proto3" json:"artifacts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -2170,7 +2175,7 @@ func (*ExecutorOutput) Descriptor() ([]byte, []int) { return file_pipeline_spec_proto_rawDescGZIP(), []int{24} } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *ExecutorOutput) GetParameters() map[string]*Value { if x != nil { return x.Parameters @@ -2206,11 +2211,11 @@ type PipelineTaskFinalStatus struct { Error *status.Status `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // The pipeline job unique id. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. PipelineJobUuid int64 `protobuf:"varint,3,opt,name=pipeline_job_uuid,json=pipelineJobUuid,proto3" json:"pipeline_job_uuid,omitempty"` // The pipeline job name from the [PipelineJob.name][]. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. PipelineJobName string `protobuf:"bytes,4,opt,name=pipeline_job_name,json=pipelineJobName,proto3" json:"pipeline_job_name,omitempty"` // The pipeline job resource name, in the format of // `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`. @@ -2265,7 +2270,7 @@ func (x *PipelineTaskFinalStatus) GetError() *status.Status { return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *PipelineTaskFinalStatus) GetPipelineJobUuid() int64 { if x != nil { return x.PipelineJobUuid @@ -2273,7 +2278,7 @@ func (x *PipelineTaskFinalStatus) GetPipelineJobUuid() int64 { return 0 } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *PipelineTaskFinalStatus) GetPipelineJobName() string { if x != nil { return x.PipelineJobName @@ -2340,7 +2345,8 @@ type PlatformSpec struct { unknownFields protoimpl.UnknownFields // Platform key to full platform config - Platforms map[string]*SinglePlatformSpec `protobuf:"bytes,1,rep,name=platforms,proto3" json:"platforms,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Platforms map[string]*SinglePlatformSpec `protobuf:"bytes,1,rep,name=platforms,proto3" json:"platforms,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + TtlStrategysecondsAfterCompletion *int32 `protobuf:"varint,2,opt,name=ttlStrategysecondsAfterCompletion,proto3,oneof" json:"ttlStrategysecondsAfterCompletion,omitempty"` } func (x *PlatformSpec) Reset() { @@ -2382,6 +2388,13 @@ func (x *PlatformSpec) GetPlatforms() map[string]*SinglePlatformSpec { return nil } +func (x *PlatformSpec) GetTtlStrategysecondsAfterCompletion() int32 { + if x != nil && x.TtlStrategysecondsAfterCompletion != nil { + return *x.TtlStrategysecondsAfterCompletion + } + return 0 +} + type SinglePlatformSpec struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2487,7 +2500,7 @@ type PipelineJob_RuntimeConfig struct { // Deprecated. Use [RuntimeConfig.parameter_values][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. Parameters map[string]*Value `protobuf:"bytes,1,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // A path in a Cloud Storage bucket which will be treated as the root // output directory of the pipeline. It is used by the system to @@ -2532,7 +2545,7 @@ func (*PipelineJob_RuntimeConfig) Descriptor() ([]byte, []int) { return file_pipeline_spec_proto_rawDescGZIP(), []int{0, 1} } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *PipelineJob_RuntimeConfig) GetParameters() map[string]*Value { if x != nil { return x.Parameters @@ -2892,6 +2905,7 @@ type DagOutputsSpec_DagOutputParameterSpec struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *DagOutputsSpec_DagOutputParameterSpec_ValueFromParameter // *DagOutputsSpec_DagOutputParameterSpec_ValueFromOneof Kind isDagOutputsSpec_DagOutputParameterSpec_Kind `protobuf_oneof:"kind"` @@ -3064,7 +3078,7 @@ type ComponentInputsSpec_ParameterSpec struct { // Specifies an input parameter's type. // Deprecated. Use [ParameterSpec.parameter_type][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. Type PrimitiveType_PrimitiveTypeEnum `protobuf:"varint,1,opt,name=type,proto3,enum=ml_pipelines.PrimitiveType_PrimitiveTypeEnum" json:"type,omitempty"` // Specifies an input parameter's type. ParameterType ParameterType_ParameterTypeEnum `protobuf:"varint,2,opt,name=parameter_type,json=parameterType,proto3,enum=ml_pipelines.ParameterType_ParameterTypeEnum" json:"parameter_type,omitempty"` @@ -3117,7 +3131,7 @@ func (*ComponentInputsSpec_ParameterSpec) Descriptor() ([]byte, []int) { return file_pipeline_spec_proto_rawDescGZIP(), []int{5, 1} } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *ComponentInputsSpec_ParameterSpec) GetType() PrimitiveType_PrimitiveTypeEnum { if x != nil { return x.Type @@ -3162,11 +3176,11 @@ type ComponentOutputsSpec_ArtifactSpec struct { ArtifactType *ArtifactTypeSchema `protobuf:"bytes,1,opt,name=artifact_type,json=artifactType,proto3" json:"artifact_type,omitempty"` // Deprecated. Use [ArtifactSpec.metadata][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. Properties map[string]*ValueOrRuntimeParameter `protobuf:"bytes,2,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Deprecated. Use [ArtifactSpec.metadata][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. CustomProperties map[string]*ValueOrRuntimeParameter `protobuf:"bytes,3,rep,name=custom_properties,json=customProperties,proto3" json:"custom_properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Properties of the Artifact. Metadata *structpb.Struct `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` @@ -3216,7 +3230,7 @@ func (x *ComponentOutputsSpec_ArtifactSpec) GetArtifactType() *ArtifactTypeSchem return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *ComponentOutputsSpec_ArtifactSpec) GetProperties() map[string]*ValueOrRuntimeParameter { if x != nil { return x.Properties @@ -3224,7 +3238,7 @@ func (x *ComponentOutputsSpec_ArtifactSpec) GetProperties() map[string]*ValueOrR return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *ComponentOutputsSpec_ArtifactSpec) GetCustomProperties() map[string]*ValueOrRuntimeParameter { if x != nil { return x.CustomProperties @@ -3262,7 +3276,7 @@ type ComponentOutputsSpec_ParameterSpec struct { // Specifies an input parameter's type. // Deprecated. Use [ParameterSpec.parameter_type][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. Type PrimitiveType_PrimitiveTypeEnum `protobuf:"varint,1,opt,name=type,proto3,enum=ml_pipelines.PrimitiveType_PrimitiveTypeEnum" json:"type,omitempty"` // Specifies an output parameter's type. ParameterType ParameterType_ParameterTypeEnum `protobuf:"varint,2,opt,name=parameter_type,json=parameterType,proto3,enum=ml_pipelines.ParameterType_ParameterTypeEnum" json:"parameter_type,omitempty"` @@ -3303,7 +3317,7 @@ func (*ComponentOutputsSpec_ParameterSpec) Descriptor() ([]byte, []int) { return file_pipeline_spec_proto_rawDescGZIP(), []int{6, 1} } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *ComponentOutputsSpec_ParameterSpec) GetType() PrimitiveType_PrimitiveTypeEnum { if x != nil { return x.Type @@ -3332,6 +3346,7 @@ type TaskInputsSpec_InputArtifactSpec struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *TaskInputsSpec_InputArtifactSpec_TaskOutputArtifact // *TaskInputsSpec_InputArtifactSpec_ComponentInputArtifact Kind isTaskInputsSpec_InputArtifactSpec_Kind `protobuf_oneof:"kind"` @@ -3421,6 +3436,7 @@ type TaskInputsSpec_InputParameterSpec struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *TaskInputsSpec_InputParameterSpec_TaskOutputParameter // *TaskInputsSpec_InputParameterSpec_RuntimeValue // *TaskInputsSpec_InputParameterSpec_ComponentInputParameter @@ -4160,6 +4176,7 @@ type ParameterIteratorSpec_ItemsSpec struct { // as a new input parameter as specified by [item_input][]. // // Types that are assignable to Kind: + // // *ParameterIteratorSpec_ItemsSpec_Raw // *ParameterIteratorSpec_ItemsSpec_InputParameter Kind isParameterIteratorSpec_ItemsSpec_Kind `protobuf_oneof:"kind"` @@ -4348,12 +4365,12 @@ type PipelineDeploymentConfig_ImporterSpec struct { // The properties of the artifact. // Deprecated. Use [ImporterSpec.metadata][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. Properties map[string]*ValueOrRuntimeParameter `protobuf:"bytes,3,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // The custom properties of the artifact. // Deprecated. Use [ImporterSpec.metadata][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. CustomProperties map[string]*ValueOrRuntimeParameter `protobuf:"bytes,4,rep,name=custom_properties,json=customProperties,proto3" json:"custom_properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Properties of the Artifact. Metadata *structpb.Struct `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"` @@ -4407,7 +4424,7 @@ func (x *PipelineDeploymentConfig_ImporterSpec) GetTypeSchema() *ArtifactTypeSch return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *PipelineDeploymentConfig_ImporterSpec) GetProperties() map[string]*ValueOrRuntimeParameter { if x != nil { return x.Properties @@ -4415,7 +4432,7 @@ func (x *PipelineDeploymentConfig_ImporterSpec) GetProperties() map[string]*Valu return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *PipelineDeploymentConfig_ImporterSpec) GetCustomProperties() map[string]*ValueOrRuntimeParameter { if x != nil { return x.CustomProperties @@ -4491,7 +4508,7 @@ func (x *PipelineDeploymentConfig_ResolverSpec) GetOutputArtifactQueries() map[s return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. type PipelineDeploymentConfig_AIPlatformCustomJobSpec struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4554,6 +4571,7 @@ type PipelineDeploymentConfig_ExecutorSpec struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Spec: + // // *PipelineDeploymentConfig_ExecutorSpec_Container // *PipelineDeploymentConfig_ExecutorSpec_Importer // *PipelineDeploymentConfig_ExecutorSpec_Resolver @@ -4621,7 +4639,7 @@ func (x *PipelineDeploymentConfig_ExecutorSpec) GetResolver() *PipelineDeploymen return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *PipelineDeploymentConfig_ExecutorSpec) GetCustomJob() *PipelineDeploymentConfig_AIPlatformCustomJobSpec { if x, ok := x.GetSpec().(*PipelineDeploymentConfig_ExecutorSpec_CustomJob); ok { return x.CustomJob @@ -4651,7 +4669,7 @@ type PipelineDeploymentConfig_ExecutorSpec_Resolver struct { type PipelineDeploymentConfig_ExecutorSpec_CustomJob struct { // Starts a Google Cloud AI Platform CustomJob. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. CustomJob *PipelineDeploymentConfig_AIPlatformCustomJobSpec `protobuf:"bytes,4,opt,name=custom_job,json=customJob,proto3,oneof"` } @@ -5074,7 +5092,7 @@ type ExecutorInput_Inputs struct { // Input parameters of the execution. // Deprecated. Use [ExecutorInput.Inputs.parameter_values][] instead. // - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in pipeline_spec.proto. Parameters map[string]*Value `protobuf:"bytes,1,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Input artifacts of the execution. Artifacts map[string]*ArtifactList `protobuf:"bytes,2,rep,name=artifacts,proto3" json:"artifacts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -5114,7 +5132,7 @@ func (*ExecutorInput_Inputs) Descriptor() ([]byte, []int) { return file_pipeline_spec_proto_rawDescGZIP(), []int{23, 0} } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in pipeline_spec.proto. func (x *ExecutorInput_Inputs) GetParameters() map[string]*Value { if x != nil { return x.Parameters @@ -6284,42 +6302,49 @@ var file_pipeline_spec_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x06, 0x51, 0x55, 0x45, 0x55, 0x45, 0x44, 0x10, 0x0b, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x4f, 0x54, 0x5f, 0x54, 0x52, 0x49, 0x47, 0x47, 0x45, 0x52, 0x45, 0x44, 0x10, 0x0c, 0x12, 0x11, 0x0a, 0x0d, 0x55, 0x4e, 0x53, 0x43, 0x48, 0x45, 0x44, 0x55, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x10, - 0x0d, 0x22, 0xb7, 0x01, 0x0a, 0x0c, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x70, + 0x0d, 0x22, 0xb0, 0x02, 0x0a, 0x0c, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x70, 0x65, 0x63, 0x12, 0x47, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6d, 0x6c, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x09, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x1a, 0x5e, 0x0a, 0x0e, 0x50, - 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x6d, 0x6c, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2e, 0x53, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x70, 0x65, 0x63, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x65, 0x0a, 0x12, 0x53, - 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x70, 0x65, - 0x63, 0x12, 0x4f, 0x0a, 0x0f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, - 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6d, 0x6c, 0x5f, - 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x0e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, - 0x65, 0x63, 0x22, 0xc6, 0x01, 0x0a, 0x18, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x44, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x53, 0x0a, 0x09, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6d, 0x6c, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, - 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x6f, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x65, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x6f, 0x72, 0x73, 0x1a, 0x55, 0x0a, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3c, 0x5a, 0x3a, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x66, 0x6c, - 0x6f, 0x77, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x69, 0x70, - 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x70, 0x65, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x52, 0x09, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x12, 0x51, 0x0a, 0x21, 0x74, + 0x74, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, + 0x73, 0x41, 0x66, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x21, 0x74, 0x74, 0x6c, 0x53, 0x74, 0x72, + 0x61, 0x74, 0x65, 0x67, 0x79, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x41, 0x66, 0x74, 0x65, + 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x1a, 0x5e, + 0x0a, 0x0e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x6d, 0x6c, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, + 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, + 0x70, 0x65, 0x63, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x24, + 0x0a, 0x22, 0x5f, 0x74, 0x74, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x73, 0x65, + 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x41, 0x66, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x65, 0x0a, 0x12, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x6c, + 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x70, 0x65, 0x63, 0x12, 0x4f, 0x0a, 0x0f, 0x64, 0x65, + 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6d, 0x6c, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x44, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x64, 0x65, 0x70, + 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x22, 0xc6, 0x01, 0x0a, 0x18, + 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, + 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x53, 0x0a, 0x09, 0x65, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6d, 0x6c, + 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, + 0x6f, 0x72, 0x6d, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x09, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x1a, 0x55, 0x0a, + 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x70, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x70, + 0x65, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -7453,6 +7478,7 @@ func file_pipeline_spec_proto_init() { (*Value_DoubleValue)(nil), (*Value_StringValue)(nil), } + file_pipeline_spec_proto_msgTypes[27].OneofWrappers = []interface{}{} file_pipeline_spec_proto_msgTypes[43].OneofWrappers = []interface{}{ (*DagOutputsSpec_DagOutputParameterSpec_ValueFromParameter)(nil), (*DagOutputsSpec_DagOutputParameterSpec_ValueFromOneof)(nil), diff --git a/api/v2alpha1/pipeline_spec.proto b/api/v2alpha1/pipeline_spec.proto index 9eeb8fe49883..f4cfb5cb574a 100644 --- a/api/v2alpha1/pipeline_spec.proto +++ b/api/v2alpha1/pipeline_spec.proto @@ -1079,6 +1079,8 @@ message PipelineStateEnum { message PlatformSpec { // Platform key to full platform config map platforms = 1; + + optional int32 ttlStrategysecondsAfterCompletion = 2; } message SinglePlatformSpec { diff --git a/sdk/python/kfp/cli/cli.py b/sdk/python/kfp/cli/cli.py index a4711ca34b7c..e0627eea205f 100644 --- a/sdk/python/kfp/cli/cli.py +++ b/sdk/python/kfp/cli/cli.py @@ -92,7 +92,7 @@ def _install_completion(shell: str) -> None: show_default=True, help='The formatting style for command output.') @click.pass_context -@click.version_option(version=kfp.__version__, message='%(prog)s %(version)s') +@click.version_option(version='dev', message='%(prog)s %(version)s') def cli(ctx: click.Context, endpoint: str, iap_client_id: str, namespace: str, other_client_id: str, other_client_secret: str, output: OutputFormat, show_completion: str, install_completion: str): diff --git a/sdk/python/kfp/compiler/pipeline_spec_builder.py b/sdk/python/kfp/compiler/pipeline_spec_builder.py index 6e4bc4e8690c..2e4869f8a749 100644 --- a/sdk/python/kfp/compiler/pipeline_spec_builder.py +++ b/sdk/python/kfp/compiler/pipeline_spec_builder.py @@ -1879,6 +1879,7 @@ def create_pipeline_spec( pipeline: pipeline_context.Pipeline, component_spec: structures.ComponentSpec, pipeline_outputs: Optional[Any] = None, + ttl_strategy_seconds_after_completion: Optional[int] = None, ) -> Tuple[pipeline_spec_pb2.PipelineSpec, pipeline_spec_pb2.PlatformSpec]: """Creates a pipeline spec object. @@ -1899,7 +1900,8 @@ def create_pipeline_spec( pipeline_spec = pipeline_spec_pb2.PipelineSpec() pipeline_spec.pipeline_info.name = pipeline.name - pipeline_spec.sdk_version = f'kfp-{kfp.__version__}' + # pipeline_spec.sdk_version = f'kfp-{kfp.__version__}' + pipeline_spec.sdk_version = f'kfp-dev' # Schema version 2.1.0 is required for kfp-pipeline-spec>0.1.13 pipeline_spec.schema_version = '2.1.0' @@ -1945,8 +1947,9 @@ def create_pipeline_spec( group_name_to_group=group_name_to_group, condition_channels=condition_channels, ) - + import pdb; pdb.set_trace() platform_spec = pipeline_spec_pb2.PlatformSpec() + platform_spec.ttlStrategysecondsAfterCompletion = ttl_strategy_seconds_after_completion for group in all_groups: build_spec_by_group( pipeline_spec=pipeline_spec, diff --git a/sdk/python/kfp/dsl/component_decorator.py b/sdk/python/kfp/dsl/component_decorator.py index 6e0c70679d9d..aa9a6dbc5bf1 100644 --- a/sdk/python/kfp/dsl/component_decorator.py +++ b/sdk/python/kfp/dsl/component_decorator.py @@ -28,7 +28,7 @@ def component(func: Optional[Callable] = None, output_component_file: Optional[str] = None, install_kfp_package: bool = True, kfp_package_path: Optional[str] = None, - pip_trusted_hosts: Optional[List[str]] = None): + ttl_active_seconds: Optional[int] = None): """Decorator for Python-function based components. A KFP component can either be a lightweight component or a containerized @@ -116,7 +116,7 @@ def pipeline(): output_component_file=output_component_file, install_kfp_package=install_kfp_package, kfp_package_path=kfp_package_path, - pip_trusted_hosts=pip_trusted_hosts) + ttl_active_seconds=ttl_active_seconds) return component_factory.create_component_from_func( func, @@ -127,4 +127,4 @@ def pipeline(): output_component_file=output_component_file, install_kfp_package=install_kfp_package, kfp_package_path=kfp_package_path, - pip_trusted_hosts=pip_trusted_hosts) + ttl_active_seconds=ttl_active_seconds) diff --git a/sdk/python/kfp/dsl/component_factory.py b/sdk/python/kfp/dsl/component_factory.py index c649424bac3a..1f628138280d 100644 --- a/sdk/python/kfp/dsl/component_factory.py +++ b/sdk/python/kfp/dsl/component_factory.py @@ -162,7 +162,8 @@ def _get_packages_to_install_command( else: kfp_pip_install_command = make_pip_install_command( install_parts=[ - f'kfp=={kfp.__version__}', + # f'kfp=={kfp.__version__}', + f'kfp==dev', '--no-deps', 'typing-extensions>=3.7.4,<5; python_version<"3.9"', ], @@ -533,6 +534,7 @@ def create_component_from_func( install_kfp_package: bool = True, kfp_package_path: Optional[str] = None, pip_trusted_hosts: Optional[List[str]] = None, + ttl_active_seconds: Optional[int] = None, ) -> python_component.PythonComponent: """Implementation for the @component decorator. @@ -676,6 +678,7 @@ def create_graph_component_from_func( name: Optional[str] = None, description: Optional[str] = None, display_name: Optional[str] = None, + ttl_strategy_seconds_after_completion: Optional[int] = None, ) -> graph_component.GraphComponent: """Implementation for the @pipeline decorator. @@ -692,6 +695,7 @@ def create_graph_component_from_func( component_spec=component_spec, pipeline_func=func, display_name=display_name, + ttl_strategy_seconds_after_completion=ttl_strategy_seconds_after_completion, ) diff --git a/sdk/python/kfp/dsl/graph_component.py b/sdk/python/kfp/dsl/graph_component.py index 2b09927dfa1d..986bf5747023 100644 --- a/sdk/python/kfp/dsl/graph_component.py +++ b/sdk/python/kfp/dsl/graph_component.py @@ -37,6 +37,7 @@ def __init__( component_spec: structures.ComponentSpec, pipeline_func: Callable, display_name: Optional[str] = None, + ttl_strategy_seconds_after_completion: Optional[int] = None, ): super().__init__(component_spec=component_spec) self.pipeline_func = pipeline_func @@ -69,6 +70,7 @@ def __init__( pipeline=dsl_pipeline, component_spec=self.component_spec, pipeline_outputs=pipeline_outputs, + ttl_strategy_seconds_after_completion=ttl_strategy_seconds_after_completion, ) pipeline_root = getattr(pipeline_func, 'pipeline_root', None) diff --git a/sdk/python/kfp/dsl/pipeline_context.py b/sdk/python/kfp/dsl/pipeline_context.py index 4d0bbbaa840e..2803c07aa392 100644 --- a/sdk/python/kfp/dsl/pipeline_context.py +++ b/sdk/python/kfp/dsl/pipeline_context.py @@ -28,7 +28,8 @@ def pipeline(func: Optional[Callable] = None, name: Optional[str] = None, description: Optional[str] = None, pipeline_root: Optional[str] = None, - display_name: Optional[str] = None) -> Callable: + display_name: Optional[str] = None, + ttl_active_seconds: Optional[int] = None) -> Callable: """Decorator used to construct a pipeline. Example @@ -50,6 +51,7 @@ def my_pipeline(a: str, b: int): pipeline_root: The root directory from which to read input and output parameters and artifacts. display_name: A human-readable name for the pipeline. + ttl_active_seconds: Delete completed workflows after a set time. """ if func is None: return functools.partial( @@ -58,6 +60,7 @@ def my_pipeline(a: str, b: int): description=description, pipeline_root=pipeline_root, display_name=display_name, + ttl_active_seconds=ttl_active_seconds, ) if pipeline_root: @@ -68,6 +71,7 @@ def my_pipeline(a: str, b: int): name=name, description=description, display_name=display_name, + ttl_strategy_seconds_after_completion=ttl_active_seconds, )