|
16 | 16 | import os
|
17 | 17 |
|
18 | 18 | import pytest
|
19 |
| -from botocore.exceptions import WaiterError |
20 | 19 |
|
| 20 | +from tests.integ.sagemaker.workflow.helpers import wait_pipeline_execution |
21 | 21 | from sagemaker.workflow.fail_step import FailStep
|
22 | 22 | from sagemaker.workflow.functions import Join
|
23 | 23 | from tests.integ.timeout import timeout_and_delete_endpoint_by_name
|
@@ -155,10 +155,7 @@ def test_pytorch_training_model_registration_and_creation_without_custom_inferen
|
155 | 155 | seconds_to_sleep=10,
|
156 | 156 | ):
|
157 | 157 | execution = pipeline.start(parameters={})
|
158 |
| - try: |
159 |
| - execution.wait(delay=30, max_attempts=60) |
160 |
| - except WaiterError: |
161 |
| - pass |
| 158 | + wait_pipeline_execution(execution=execution) |
162 | 159 | execution_steps = execution.list_steps()
|
163 | 160 | is_execution_fail = False
|
164 | 161 | for step in execution_steps:
|
@@ -284,10 +281,7 @@ def test_pytorch_training_model_registration_and_creation_with_custom_inference(
|
284 | 281 | seconds_to_sleep=10,
|
285 | 282 | ):
|
286 | 283 | execution = pipeline.start(parameters={})
|
287 |
| - try: |
288 |
| - execution.wait(delay=30, max_attempts=60) |
289 |
| - except WaiterError: |
290 |
| - pass |
| 284 | + wait_pipeline_execution(execution=execution) |
291 | 285 | execution_steps = execution.list_steps()
|
292 | 286 | is_execution_fail = False
|
293 | 287 | for step in execution_steps:
|
@@ -372,10 +366,7 @@ def test_mxnet_model_registration_with_custom_inference(
|
372 | 366 | seconds_to_sleep=10,
|
373 | 367 | ):
|
374 | 368 | execution = pipeline.start()
|
375 |
| - try: |
376 |
| - execution.wait(delay=30, max_attempts=60) |
377 |
| - except WaiterError: |
378 |
| - pass |
| 369 | + wait_pipeline_execution(execution=execution) |
379 | 370 | execution_steps = execution.list_steps()
|
380 | 371 |
|
381 | 372 | assert len(execution_steps) == 1
|
@@ -550,10 +541,7 @@ def test_model_registration_with_drift_check_baselines_and_model_metrics(
|
550 | 541 |
|
551 | 542 | assert response["PipelineArn"] == create_arn
|
552 | 543 |
|
553 |
| - try: |
554 |
| - execution.wait(delay=30, max_attempts=60) |
555 |
| - except WaiterError: |
556 |
| - pass |
| 544 | + wait_pipeline_execution(execution=execution) |
557 | 545 | execution_steps = execution.list_steps()
|
558 | 546 |
|
559 | 547 | assert len(execution_steps) == 1
|
@@ -667,10 +655,7 @@ def test_model_registration_with_tensorflow_model_with_pipeline_model(
|
667 | 655 | seconds_to_sleep=10,
|
668 | 656 | ):
|
669 | 657 | execution = pipeline.start(parameters={})
|
670 |
| - try: |
671 |
| - execution.wait(delay=30, max_attempts=60) |
672 |
| - except WaiterError: |
673 |
| - pass |
| 658 | + wait_pipeline_execution(execution=execution) |
674 | 659 | execution_steps = execution.list_steps()
|
675 | 660 | is_execution_fail = False
|
676 | 661 | for step in execution_steps:
|
@@ -750,10 +735,7 @@ def test_xgboost_model_register_and_deploy_with_runtime_repack(
|
750 | 735 | seconds_to_sleep=10,
|
751 | 736 | ):
|
752 | 737 | execution = pipeline.start(parameters={})
|
753 |
| - try: |
754 |
| - execution.wait(delay=30, max_attempts=60) |
755 |
| - except WaiterError: |
756 |
| - pass |
| 738 | + wait_pipeline_execution(execution=execution) |
757 | 739 |
|
758 | 740 | # Verify the pipeline execution succeeded
|
759 | 741 | step_register_model = None
|
@@ -866,10 +848,7 @@ def test_tensorflow_model_register_and_deploy_with_runtime_repack(
|
866 | 848 | seconds_to_sleep=10,
|
867 | 849 | ):
|
868 | 850 | execution = pipeline.start(parameters={})
|
869 |
| - try: |
870 |
| - execution.wait(delay=30, max_attempts=60) |
871 |
| - except WaiterError: |
872 |
| - pass |
| 851 | + wait_pipeline_execution(execution=execution) |
873 | 852 |
|
874 | 853 | # Verify the pipeline execution succeeded
|
875 | 854 | step_register_model = None
|
|
0 commit comments