capo-sagemaker-runtime 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {capo_sagemaker_runtime-0.2.0/src/capo_sagemaker_runtime.egg-info → capo_sagemaker_runtime-0.3.0}/PKG-INFO +1 -1
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/pyproject.toml +1 -1
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_operations/amazon_sage_maker_runtime/invoke_endpoint.py +3 -2
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_operations/amazon_sage_maker_runtime/invoke_endpoint_async.py +3 -2
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_operations/amazon_sage_maker_runtime/invoke_endpoint_with_response_stream.py +3 -2
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_services/_pipeline.py +17 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0/src/capo_sagemaker_runtime.egg-info}/PKG-INFO +1 -1
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/LICENSE +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/README.md +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/setup.cfg +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/__init__.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_async.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_auth/_identity.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_auth/_providers.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_auth/_signers.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_auth/_sigv4.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_auth/_zapros_handler.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_body.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_iter.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_pagination.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_protocol/__init__.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_protocol/errors.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_protocol/eventstream.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_protocol/serialize.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_protocol/xml.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_rule_engine/__init__.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_rule_engine/_aws_partition.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_rule_engine/_endpoint_rule_set.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_rule_engine/_endpoint_runtime.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_services/_aws_config.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_services/async_sage_maker_runtime.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_services/sage_maker_runtime.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/__init__.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/_base.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/internal_dependency_exception.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/internal_failure.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/internal_stream_failure.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/model_error.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/model_not_ready_exception.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/model_stream_error.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/service_unavailable.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/errors/validation_error.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/py.typed +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/_prelude/blob.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/_prelude/timestamp.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/async_body_blob.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/body_blob.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/custom_attributes_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/enable_explanations_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/endpoint_name.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/error_code.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/filename_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/inference_component_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/inference_id.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/input_location_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/invocation_timeout_seconds_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/invoke_endpoint_async_input.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/invoke_endpoint_async_output.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/invoke_endpoint_input.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/invoke_endpoint_output.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/invoke_endpoint_with_response_stream_input.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/invoke_endpoint_with_response_stream_output.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/log_stream_arn.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/message.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/new_session_response_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/part_blob.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/payload_part.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/prefix_aware_id_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/request_ttl_seconds_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/response_stream.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/s3_output_path_extension_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/session_id_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/session_id_or_new_session_constant_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/status_code.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/target_container_hostname_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/target_model_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/types/target_variant_header.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime.egg-info/SOURCES.txt +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime.egg-info/dependency_links.txt +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime.egg-info/requires.txt +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime.egg-info/top_level.txt +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/tests/test_body.py +0 -0
- {capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/tests/test_sigv4.py +0 -0
|
@@ -29,6 +29,7 @@ from capo_sagemaker_runtime._rule_engine._endpoint_rule_set import (
|
|
|
29
29
|
from capo_sagemaker_runtime._services._pipeline import (
|
|
30
30
|
AsyncOperationOptions,
|
|
31
31
|
OperationOptions,
|
|
32
|
+
raise_error,
|
|
32
33
|
)
|
|
33
34
|
from capo_sagemaker_runtime.errors import UnknownServiceError
|
|
34
35
|
|
|
@@ -210,7 +211,7 @@ def invoke_endpoint(
|
|
|
210
211
|
try:
|
|
211
212
|
if response.status >= 300:
|
|
212
213
|
response.read()
|
|
213
|
-
|
|
214
|
+
raise_error(response, handle_error)
|
|
214
215
|
return handle_response(response), response
|
|
215
216
|
except BaseException:
|
|
216
217
|
response.close()
|
|
@@ -228,7 +229,7 @@ async def async_invoke_endpoint(
|
|
|
228
229
|
try:
|
|
229
230
|
if response.status >= 300:
|
|
230
231
|
await response.aread()
|
|
231
|
-
|
|
232
|
+
raise_error(response, handle_error)
|
|
232
233
|
return await async_handle_response(response), response
|
|
233
234
|
except BaseException:
|
|
234
235
|
await response.aclose()
|
|
@@ -26,6 +26,7 @@ from capo_sagemaker_runtime._rule_engine._endpoint_rule_set import (
|
|
|
26
26
|
from capo_sagemaker_runtime._services._pipeline import (
|
|
27
27
|
AsyncOperationOptions,
|
|
28
28
|
OperationOptions,
|
|
29
|
+
raise_error,
|
|
29
30
|
)
|
|
30
31
|
from capo_sagemaker_runtime.errors import UnknownServiceError
|
|
31
32
|
|
|
@@ -173,7 +174,7 @@ def invoke_endpoint_async(
|
|
|
173
174
|
try:
|
|
174
175
|
if response.status >= 300:
|
|
175
176
|
response.read()
|
|
176
|
-
|
|
177
|
+
raise_error(response, handle_error)
|
|
177
178
|
return handle_response(response), response
|
|
178
179
|
except BaseException:
|
|
179
180
|
response.close()
|
|
@@ -191,7 +192,7 @@ async def async_invoke_endpoint_async(
|
|
|
191
192
|
try:
|
|
192
193
|
if response.status >= 300:
|
|
193
194
|
await response.aread()
|
|
194
|
-
|
|
195
|
+
raise_error(response, handle_error)
|
|
195
196
|
return await async_handle_response(response), response
|
|
196
197
|
except BaseException:
|
|
197
198
|
await response.aclose()
|
|
@@ -35,6 +35,7 @@ from capo_sagemaker_runtime._rule_engine._endpoint_rule_set import (
|
|
|
35
35
|
from capo_sagemaker_runtime._services._pipeline import (
|
|
36
36
|
AsyncOperationOptions,
|
|
37
37
|
OperationOptions,
|
|
38
|
+
raise_error,
|
|
38
39
|
)
|
|
39
40
|
from capo_sagemaker_runtime.errors import UnknownServiceError
|
|
40
41
|
|
|
@@ -211,7 +212,7 @@ def invoke_endpoint_with_response_stream(
|
|
|
211
212
|
try:
|
|
212
213
|
if response.status >= 300:
|
|
213
214
|
response.read()
|
|
214
|
-
|
|
215
|
+
raise_error(response, handle_error)
|
|
215
216
|
return handle_response(response), response
|
|
216
217
|
except BaseException:
|
|
217
218
|
response.close()
|
|
@@ -229,7 +230,7 @@ async def async_invoke_endpoint_with_response_stream(
|
|
|
229
230
|
try:
|
|
230
231
|
if response.status >= 300:
|
|
231
232
|
await response.aread()
|
|
232
|
-
|
|
233
|
+
raise_error(response, handle_error)
|
|
233
234
|
return await async_handle_response(response), response
|
|
234
235
|
except BaseException:
|
|
235
236
|
await response.aclose()
|
|
@@ -6,6 +6,7 @@ from collections.abc import AsyncIterator, Iterator, Sequence
|
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from typing import TYPE_CHECKING, Awaitable, Callable, Generic, TypeVar, cast
|
|
8
8
|
|
|
9
|
+
from typing_extensions import Never
|
|
9
10
|
from zapros import (
|
|
10
11
|
AsyncClient,
|
|
11
12
|
Client,
|
|
@@ -135,6 +136,22 @@ async def aexecute_pipeline(
|
|
|
135
136
|
return await make_chain(0)(request)
|
|
136
137
|
|
|
137
138
|
|
|
139
|
+
def raise_error(response: Response, handle_error: Callable[[Response], Never]) -> Never:
|
|
140
|
+
try:
|
|
141
|
+
handle_error(response)
|
|
142
|
+
except ServiceError as exc:
|
|
143
|
+
# The response itself can say a retry is safe, even when the error is
|
|
144
|
+
# not marked @retryable: a 429, a transient 5xx or a Retry-After header.
|
|
145
|
+
if response.status == 429:
|
|
146
|
+
exc.is_throttling_error = True
|
|
147
|
+
if (
|
|
148
|
+
response.status in (429, 500, 502, 503, 504)
|
|
149
|
+
or "retry-after" in response.headers
|
|
150
|
+
):
|
|
151
|
+
exc.is_retryable = True
|
|
152
|
+
raise
|
|
153
|
+
|
|
154
|
+
|
|
138
155
|
def _is_retryable(exc: Exception) -> bool:
|
|
139
156
|
if isinstance(exc, ServiceError):
|
|
140
157
|
return exc.is_retryable
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/__init__.py
RENAMED
|
File without changes
|
{capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_async.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_body.py
RENAMED
|
File without changes
|
{capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/_iter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{capo_sagemaker_runtime-0.2.0 → capo_sagemaker_runtime-0.3.0}/src/capo_sagemaker_runtime/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|