23
23
from sagemaker .s3 import S3Uploader
24
24
from sagemaker .session import production_variant
25
25
from sagemaker .sparkml import SparkMLModel
26
- from sagemaker .content_types import CONTENT_TYPE_CSV
27
26
from sagemaker .utils import unique_name_from_base
28
27
from sagemaker .predictor import Predictor
29
28
from sagemaker .serializers import CSVSerializer
@@ -153,17 +152,17 @@ def test_target_variant_invocation(sagemaker_session, multi_variant_endpoint):
153
152
response = sagemaker_session .sagemaker_runtime_client .invoke_endpoint (
154
153
EndpointName = multi_variant_endpoint .endpoint_name ,
155
154
Body = TEST_CSV_DATA ,
156
- ContentType = CONTENT_TYPE_CSV ,
157
- Accept = CONTENT_TYPE_CSV ,
155
+ ContentType = "text/csv" ,
156
+ Accept = "text/csv" ,
158
157
TargetVariant = TEST_VARIANT_1 ,
159
158
)
160
159
assert response ["InvokedProductionVariant" ] == TEST_VARIANT_1
161
160
162
161
response = sagemaker_session .sagemaker_runtime_client .invoke_endpoint (
163
162
EndpointName = multi_variant_endpoint .endpoint_name ,
164
163
Body = TEST_CSV_DATA ,
165
- ContentType = CONTENT_TYPE_CSV ,
166
- Accept = CONTENT_TYPE_CSV ,
164
+ ContentType = "text/csv" ,
165
+ Accept = "text/csv" ,
167
166
TargetVariant = TEST_VARIANT_2 ,
168
167
)
169
168
assert response ["InvokedProductionVariant" ] == TEST_VARIANT_2
@@ -174,8 +173,8 @@ def test_predict_invocation_with_target_variant(sagemaker_session, multi_variant
174
173
endpoint_name = multi_variant_endpoint .endpoint_name ,
175
174
sagemaker_session = sagemaker_session ,
176
175
serializer = CSVSerializer (),
177
- content_type = CONTENT_TYPE_CSV ,
178
- accept = CONTENT_TYPE_CSV ,
176
+ content_type = "text/csv" ,
177
+ accept = "text/csv" ,
179
178
)
180
179
181
180
# Validate that no exception is raised when the target_variant is specified.
@@ -191,8 +190,8 @@ def test_variant_traffic_distribution(sagemaker_session, multi_variant_endpoint)
191
190
response = sagemaker_session .sagemaker_runtime_client .invoke_endpoint (
192
191
EndpointName = multi_variant_endpoint .endpoint_name ,
193
192
Body = TEST_CSV_DATA ,
194
- ContentType = CONTENT_TYPE_CSV ,
195
- Accept = CONTENT_TYPE_CSV ,
193
+ ContentType = "text/csv" ,
194
+ Accept = "text/csv" ,
196
195
)
197
196
if response ["InvokedProductionVariant" ] == TEST_VARIANT_1 :
198
197
variant_1_invocation_count += 1
@@ -274,17 +273,17 @@ def test_target_variant_invocation_local_mode(sagemaker_session, multi_variant_e
274
273
response = sagemaker_session .sagemaker_runtime_client .invoke_endpoint (
275
274
EndpointName = multi_variant_endpoint .endpoint_name ,
276
275
Body = TEST_CSV_DATA ,
277
- ContentType = CONTENT_TYPE_CSV ,
278
- Accept = CONTENT_TYPE_CSV ,
276
+ ContentType = "text/csv" ,
277
+ Accept = "text/csv" ,
279
278
TargetVariant = TEST_VARIANT_1 ,
280
279
)
281
280
assert response ["InvokedProductionVariant" ] == TEST_VARIANT_1
282
281
283
282
response = sagemaker_session .sagemaker_runtime_client .invoke_endpoint (
284
283
EndpointName = multi_variant_endpoint .endpoint_name ,
285
284
Body = TEST_CSV_DATA ,
286
- ContentType = CONTENT_TYPE_CSV ,
287
- Accept = CONTENT_TYPE_CSV ,
285
+ ContentType = "text/csv" ,
286
+ Accept = "text/csv" ,
288
287
TargetVariant = TEST_VARIANT_2 ,
289
288
)
290
289
assert response ["InvokedProductionVariant" ] == TEST_VARIANT_2
@@ -302,8 +301,8 @@ def test_predict_invocation_with_target_variant_local_mode(
302
301
endpoint_name = multi_variant_endpoint .endpoint_name ,
303
302
sagemaker_session = sagemaker_session ,
304
303
serializer = CSVSerializer (),
305
- content_type = CONTENT_TYPE_CSV ,
306
- accept = CONTENT_TYPE_CSV ,
304
+ content_type = "text/csv" ,
305
+ accept = "text/csv" ,
307
306
)
308
307
309
308
# Validate that no exception is raised when the target_variant is specified.
0 commit comments