Skip to content

Commit 2316005

Browse files
committed
Remove unused semaphore/mutex pipeline config
Signed-off-by: sduvvuri1603 <[email protected]>
1 parent feedbf7 commit 2316005

File tree

13 files changed

+18
-582
lines changed

13 files changed

+18
-582
lines changed

api/v2alpha1/go/pipelinespec/pipeline_spec.pb.go

Lines changed: 4 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v2alpha1/pipeline_spec.proto

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,11 +1166,8 @@ message KubernetesWorkspaceConfig {
11661166

11671167
// Spec for pipeline-level config options. See PipelineConfig DSL class.
11681168
message PipelineConfig {
1169-
// Name of the semaphore key to control pipeline concurrency
1170-
string semaphore_key = 1;
1171-
1172-
// Name of the mutex to ensure mutual exclusion
1173-
string mutex_name = 2;
1169+
reserved 1, 2;
1170+
reserved "semaphore_key", "mutex_name";
11741171

11751172
// Time to live configuration after the pipeline run is completed for
11761173
// ephemeral resources created by the pipeline run.

backend/test/proto_tests/objects.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,7 @@ var platformSpec = &specPB.PlatformSpec{
306306
},
307307
},
308308
PipelineConfig: &specPB.PipelineConfig{
309-
SemaphoreKey: "test-key",
310-
MutexName: "test-mutex",
311-
ResourceTtl: 24,
309+
ResourceTtl: 24,
312310
},
313311
},
314312
},

backend/test/proto_tests/testdata/generated-1791485/platform_spec.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
"project": "test-project"
1616
},
1717
"pipelineConfig": {
18-
"semaphore_key": "test-key",
19-
"mutex_name": "test-mutex",
2018
"resource_ttl": 24
2119
}
2220
}

backend/test/proto_tests/testdata/generated-1791485/platform_spec.pb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
�
2+
x
33

4-
kubernetes�
4+
kubernetesj
55
;
66
9
77
root-executor(
@@ -12,6 +12,4 @@ kubernetes
1212
test-image
1313
kubernetes
1414

15-
project test-project"
16-
test-key
17-
test-mutex
15+
project test-project"

proposals/11875-pipeline-workspace/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,17 @@ index d986a048b..866696419 100644
388388
+ google.protobuf.Struct pvc_spec_patch = 1;
389389
+}
390390
+
391-
// Spec for pipeline-level config options. See PipelineConfig DSL class.
391+
// Spec for pipeline-level config options. See PipelineConfig DSL class.
392392
message PipelineConfig {
393-
// Name of the semaphore key to control pipeline concurrency
394-
@@ -1115,4 +1128,7 @@ message PipelineConfig {
393+
reserved 1, 2;
394+
reserved "semaphore_key", "mutex_name";
395+
395396
// Time to live configuration after the pipeline run is completed for
396397
// ephemeral resources created by the pipeline run.
397398
int32 resource_ttl = 3;
398-
+
399-
+ // Configuration for the workspace
400-
+ optional WorkspaceConfig workspace = 4;
399+
400+
// Configuration for the workspace
401+
optional WorkspaceConfig workspace = 4;
401402
}
402403
```
403404

sdk/python/kfp/compiler/compiler_test.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4334,68 +4334,6 @@ def my_pipeline():
43344334
compiler.Compiler().compile(
43354335
pipeline_func=my_pipeline, package_path=output_yaml)
43364336

4337-
4338-
class TestPipelineSemaphoreMutex(unittest.TestCase):
4339-
4340-
def test_pipeline_with_semaphore(self):
4341-
"""Test that pipeline config correctly sets the semaphore key."""
4342-
config = PipelineConfig()
4343-
config.semaphore_key = 'semaphore'
4344-
4345-
@dsl.pipeline(pipeline_config=config)
4346-
def my_pipeline():
4347-
task = comp()
4348-
4349-
with tempfile.TemporaryDirectory() as tempdir:
4350-
output_yaml = os.path.join(tempdir, 'pipeline.yaml')
4351-
compiler.Compiler().compile(
4352-
pipeline_func=my_pipeline, package_path=output_yaml)
4353-
4354-
with open(output_yaml, 'r') as f:
4355-
pipeline_docs = list(yaml.safe_load_all(f))
4356-
4357-
platform_spec = None
4358-
for doc in pipeline_docs:
4359-
if 'platforms' in doc:
4360-
platform_spec = doc
4361-
break
4362-
4363-
self.assertIsNotNone(platform_spec,
4364-
'No platforms section found in compiled output')
4365-
kubernetes_spec = platform_spec['platforms']['kubernetes'][
4366-
'pipelineConfig']
4367-
self.assertEqual(kubernetes_spec['semaphoreKey'], 'semaphore')
4368-
4369-
def test_pipeline_with_mutex(self):
4370-
"""Test that pipeline config correctly sets the mutex name."""
4371-
config = PipelineConfig()
4372-
config.mutex_name = 'mutex'
4373-
4374-
@dsl.pipeline(pipeline_config=config)
4375-
def my_pipeline():
4376-
task = comp()
4377-
4378-
with tempfile.TemporaryDirectory() as tempdir:
4379-
output_yaml = os.path.join(tempdir, 'pipeline.yaml')
4380-
compiler.Compiler().compile(
4381-
pipeline_func=my_pipeline, package_path=output_yaml)
4382-
4383-
with open(output_yaml, 'r') as f:
4384-
pipeline_docs = list(yaml.safe_load_all(f))
4385-
4386-
platform_spec = None
4387-
for doc in pipeline_docs:
4388-
if 'platforms' in doc:
4389-
platform_spec = doc
4390-
break
4391-
4392-
self.assertIsNotNone(platform_spec,
4393-
'No platforms section found in compiled output')
4394-
kubernetes_spec = platform_spec['platforms']['kubernetes'][
4395-
'pipelineConfig']
4396-
self.assertEqual(kubernetes_spec['mutexName'], 'mutex')
4397-
4398-
43994337
class ExtractInputOutputDescription(unittest.TestCase):
44004338

44014339
def test_no_descriptions(self):

sdk/python/kfp/compiler/pipeline_spec_builder.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,11 +2253,6 @@ def _merge_pipeline_config(pipelineConfig: pipeline_config.PipelineConfig,
22532253
if workspace is not None:
22542254
config_dict['workspace'] = workspace.get_workspace()
22552255

2256-
if pipelineConfig.semaphore_key is not None:
2257-
config_dict['semaphoreKey'] = pipelineConfig.semaphore_key
2258-
if pipelineConfig.mutex_name is not None:
2259-
config_dict['mutexName'] = pipelineConfig.mutex_name
2260-
22612256
if config_dict:
22622257
json_format.ParseDict({'pipelineConfig': config_dict},
22632258
platformSpec.platforms['kubernetes'])

sdk/python/kfp/dsl/pipeline_config.py

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -96,57 +96,5 @@ def set_kubernetes_config(self,
9696
class PipelineConfig:
9797
"""PipelineConfig contains pipeline-level config options."""
9898

99-
def __init__(self,
100-
workspace: Optional[WorkspaceConfig] = None,
101-
semaphore_key: Optional[str] = None,
102-
mutex_name: Optional[str] = None):
99+
def __init__(self, workspace: Optional[WorkspaceConfig] = None):
103100
self.workspace = workspace
104-
self._semaphore_key = semaphore_key
105-
self._mutex_name = mutex_name
106-
107-
@property
108-
def semaphore_key(self) -> Optional[str]:
109-
"""Get the semaphore key for controlling pipeline concurrency.
110-
111-
Returns:
112-
Optional[str]: The semaphore key, or None if not set.
113-
"""
114-
return self._semaphore_key
115-
116-
@semaphore_key.setter
117-
def semaphore_key(self, value: str):
118-
"""Set the semaphore key to control pipeline concurrency.
119-
120-
Pipelines with the same semaphore key will be limited to a configured maximum
121-
number of concurrent executions. This allows you to control resource usage by
122-
ensuring that only a specific number of pipelines can run simultaneously.
123-
124-
Note: A pipeline can use both semaphores and mutexes together. The pipeline
125-
will wait until all required locks are available before starting.
126-
127-
Args:
128-
value (str): The semaphore key name for controlling concurrent executions.
129-
"""
130-
self._semaphore_key = (value and value.strip()) or None
131-
132-
@property
133-
def mutex_name(self) -> Optional[str]:
134-
"""Get the mutex name for exclusive pipeline execution.
135-
136-
Returns:
137-
Optional[str]: The mutex name, or None if not set.
138-
"""
139-
return self._mutex_name
140-
141-
@mutex_name.setter
142-
def mutex_name(self, value: str):
143-
"""Set the name of the mutex to ensure mutual exclusion.
144-
145-
Pipelines with the same mutex name will only run one at a time. This ensures
146-
exclusive access to shared resources and prevents conflicts when multiple
147-
pipelines would otherwise compete for the same resources.
148-
149-
Args:
150-
value (str): Name of the mutex for exclusive pipeline execution.
151-
"""
152-
self._mutex_name = (value and value.strip()) or None

sdk/python/test/compilation/pipeline_compilation_test.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@
211211
my_pipeline as retry_pipeline
212212
from test_data.sdk_compiled_pipelines.valid.pipeline_with_secret_as_volume import \
213213
pipeline_secret_volume
214-
from test_data.sdk_compiled_pipelines.valid.pipeline_with_semphore import \
215-
pipeline_with_semaphore
216214
from test_data.sdk_compiled_pipelines.valid.pipeline_with_string_machine_fields_pipeline_input import \
217215
pipeline as pipeline_with_string_machine_fields_pipeline_input
218216
from test_data.sdk_compiled_pipelines.valid.pipeline_with_string_machine_fields_task_output import \
@@ -1002,13 +1000,6 @@ def __repr__(self) -> str:
10021000
compiled_file_name='pythonic_artifact_with_single_return.yaml',
10031001
expected_compiled_file_path=f'{_VALID_PIPELINE_FILES}/pythonic_artifact_with_single_return.yaml'
10041002
),
1005-
TestData(
1006-
pipeline_name='pipeline-with-semaphore',
1007-
pipeline_func=pipeline_with_semaphore,
1008-
pipline_func_args=None,
1009-
compiled_file_name='pipeline_with_semaphore.yaml',
1010-
expected_compiled_file_path=f'{_VALID_PIPELINE_FILES}/pipeline_with_semaphore.yaml'
1011-
),
10121003
TestData(
10131004
pipeline_name='pipeline-with-condition-dynamic-task-output',
10141005
pipeline_func=pipeline_with_dynamic_condition_output,

0 commit comments

Comments
 (0)