1919
2020from tests .integ .sagemaker .workflow .helpers import wait_pipeline_execution
2121from sagemaker .processing import ProcessingInput
22- from sagemaker .session import get_execution_role
2322from sagemaker .sklearn .processing import SKLearnProcessor
2423from sagemaker .dataset_definition .inputs import DatasetDefinition , AthenaDatasetDefinition
2524from sagemaker .workflow .execution_variables import ExecutionVariables
3332from tests .integ import DATA_DIR
3433
3534
36- @pytest .fixture (scope = "module" )
37- def region_name (sagemaker_session ):
38- return sagemaker_session .boto_session .region_name
39-
40-
41- @pytest .fixture (scope = "module" )
42- def role (sagemaker_session ):
43- return get_execution_role (sagemaker_session )
44-
45-
46- @pytest .fixture (scope = "module" )
47- def script_dir ():
48- return os .path .join (DATA_DIR , "sklearn_processing" )
49-
50-
5135@pytest .fixture
5236def pipeline_name ():
5337 return f"my-pipeline-{ int (time .time () * 10 ** 7 )} "
5438
5539
5640@pytest .fixture
57- def smclient (sagemaker_session ):
58- return sagemaker_session .boto_session .client ("sagemaker" )
59-
60-
61- @pytest .fixture
62- def athena_dataset_definition (sagemaker_session ):
41+ def athena_dataset_definition (sagemaker_session_for_pipeline ):
6342 return DatasetDefinition (
6443 local_path = "/opt/ml/processing/input/add" ,
6544 data_distribution_type = "FullyReplicated" ,
@@ -69,15 +48,15 @@ def athena_dataset_definition(sagemaker_session):
6948 database = "default" ,
7049 work_group = "workgroup" ,
7150 query_string = 'SELECT * FROM "default"."s3_test_table_$STAGE_$REGIONUNDERSCORED";' ,
72- output_s3_uri = f"s3://{ sagemaker_session .default_bucket ()} /add" ,
51+ output_s3_uri = f"s3://{ sagemaker_session_for_pipeline .default_bucket ()} /add" ,
7352 output_format = "JSON" ,
7453 output_compression = "GZIP" ,
7554 ),
7655 )
7756
7857
7958def test_pipeline_execution_with_default_experiment_config (
80- sagemaker_session ,
59+ sagemaker_session_for_pipeline ,
8160 smclient ,
8261 role ,
8362 sklearn_latest_version ,
@@ -99,7 +78,7 @@ def test_pipeline_execution_with_default_experiment_config(
9978 instance_type = cpu_instance_type ,
10079 instance_count = instance_count ,
10180 command = ["python3" ],
102- sagemaker_session = sagemaker_session ,
81+ sagemaker_session = sagemaker_session_for_pipeline ,
10382 base_job_name = "test-sklearn" ,
10483 )
10584
@@ -113,7 +92,7 @@ def test_pipeline_execution_with_default_experiment_config(
11392 name = pipeline_name ,
11493 parameters = [instance_count ],
11594 steps = [step_sklearn ],
116- sagemaker_session = sagemaker_session ,
95+ sagemaker_session = sagemaker_session_for_pipeline ,
11796 )
11897
11998 try :
@@ -142,7 +121,7 @@ def test_pipeline_execution_with_default_experiment_config(
142121
143122
144123def test_pipeline_execution_with_custom_experiment_config (
145- sagemaker_session ,
124+ sagemaker_session_for_pipeline ,
146125 smclient ,
147126 role ,
148127 sklearn_latest_version ,
@@ -164,7 +143,7 @@ def test_pipeline_execution_with_custom_experiment_config(
164143 instance_type = cpu_instance_type ,
165144 instance_count = instance_count ,
166145 command = ["python3" ],
167- sagemaker_session = sagemaker_session ,
146+ sagemaker_session = sagemaker_session_for_pipeline ,
168147 base_job_name = "test-sklearn" ,
169148 )
170149
@@ -185,7 +164,7 @@ def test_pipeline_execution_with_custom_experiment_config(
185164 trial_name = Join (on = "-" , values = ["my-trial" , ExecutionVariables .PIPELINE_EXECUTION_ID ]),
186165 ),
187166 steps = [step_sklearn ],
188- sagemaker_session = sagemaker_session ,
167+ sagemaker_session = sagemaker_session_for_pipeline ,
189168 )
190169
191170 try :
0 commit comments