Skip to content

Commit e777674

Browse files
author
Ameen Khan
committed
Updated docstring, added describe call to check config
1 parent c30bb0f commit e777674

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/sagemaker/workflow/pipeline.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ def create(
105105
description (str): A description of the pipeline.
106106
tags (List[Dict[str, str]]): A list of {"Key": "string", "Value": "string"} dicts as
107107
tags.
108-
parallelism_config (Optional[Config for parallel steps, Parallelism configuration that
109-
is applied to each of. the executions
108+
parallelism_config (Optional[ParallelismConfiguration]): Parallelism configuration
109+
that is applied to each of the executions of the pipeline. It takes precedence
110+
over the parallelism configuration of the parent pipeline.
110111
111112
Returns:
112113
A response dict from the service.
@@ -130,8 +131,9 @@ def _create_args(
130131
Args:
131132
role_arn (str): The role arn that is assumed by pipelines to create step artifacts.
132133
description (str): A description of the pipeline.
133-
parallelism_config (Optional[ParallelismConfiguration]): Config for parallel steps, that
134-
is applied to each of the executions.
134+
parallelism_config (Optional[ParallelismConfiguration]): Parallelism configuration
135+
that is applied to each of the executions of the pipeline. It takes precedence
136+
over the parallelism configuration of the parent pipeline.
135137
136138
Returns:
137139
A keyword argument dict for calling create_pipeline.
@@ -188,8 +190,9 @@ def update(
188190
Args:
189191
role_arn (str): The role arn that is assumed by pipelines to create step artifacts.
190192
description (str): A description of the pipeline.
191-
parallelism_config (Optional[ParallelismConfiguration]): Config for parallel steps, that
192-
is applied to each of the executions.
193+
parallelism_config (Optional[ParallelismConfiguration]): Parallelism configuration
194+
that is applied to each of the executions of the pipeline. It takes precedence
195+
over the parallelism configuration of the parent pipeline.
193196
194197
Returns:
195198
A response dict from the service.
@@ -265,8 +268,9 @@ def start(
265268
pipeline parameters.
266269
execution_display_name (str): The display name of the pipeline execution.
267270
execution_description (str): A description of the execution.
268-
parallelism_config (Optional[ParallelismConfiguration]): Config for parallel steps, that
269-
is applied to each of the executions.
271+
parallelism_config (Optional[ParallelismConfiguration]): Parallelism configuration
272+
that is applied to each of the executions of the pipeline. It takes precedence
273+
over the parallelism configuration of the parent pipeline.
270274
271275
Returns:
272276
A `_PipelineExecution` instance, if successful.

tests/integ/test_workflow.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -2307,6 +2307,8 @@ def test_large_pipeline(sagemaker_session, role, pipeline_name, region_name):
23072307
fr"arn:aws:sagemaker:{region_name}:\d{{12}}:pipeline/{pipeline_name}",
23082308
create_arn,
23092309
)
2310+
response = pipeline.describe()
2311+
assert len(json.loads(pipeline.describe()["PipelineDefinition"])["Steps"]) == 2000
23102312

23112313
pipeline.parameters = [ParameterInteger(name="InstanceCount", default_value=1)]
23122314
response = pipeline.update(role)
@@ -2321,7 +2323,7 @@ def test_large_pipeline(sagemaker_session, role, pipeline_name, region_name):
23212323
except Exception:
23222324
pass
23232325

2324-
def test_create_parallelism_config(sagemaker_session, role, pipeline_name, region_name):
2326+
def test_create_and_update_with_parallelism_config(sagemaker_session, role, pipeline_name, region_name):
23252327
instance_count = ParameterInteger(name="InstanceCount", default_value=2)
23262328

23272329
outputParam = CallbackOutput(output_name="output", output_type=CallbackOutputTypeEnum.String)
@@ -2342,21 +2344,28 @@ def test_create_parallelism_config(sagemaker_session, role, pipeline_name, regio
23422344
sagemaker_session=sagemaker_session,
23432345
)
23442346

2347+
23452348
try:
23462349
response = pipeline.create(role, parallelism_config={"MaxParallelExecutionSteps": 50})
23472350
create_arn = response["PipelineArn"]
23482351
assert re.match(
23492352
fr"arn:aws:sagemaker:{region_name}:\d{{12}}:pipeline/{pipeline_name}",
23502353
create_arn,
23512354
)
2355+
response = pipeline.describe()
2356+
assert response["ParallelismConfiguration"]["MaxParallelExecutionSteps"] == 50
23522357

23532358
pipeline.parameters = [ParameterInteger(name="InstanceCount", default_value=1)]
2354-
response = pipeline.update(role, parallelism_config={"MaxParallelExecutionSteps": 50})
2359+
response = pipeline.update(role, parallelism_config={"MaxParallelExecutionSteps": 55})
23552360
update_arn = response["PipelineArn"]
23562361
assert re.match(
23572362
fr"arn:aws:sagemaker:{region_name}:\d{{12}}:pipeline/{pipeline_name}",
23582363
update_arn,
23592364
)
2365+
2366+
response = pipeline.describe()
2367+
assert response["ParallelismConfiguration"]["MaxParallelExecutionSteps"] == 55
2368+
23602369
finally:
23612370
try:
23622371
pipeline.delete()

0 commit comments

Comments
 (0)