Executors
RequestMethod
¶
Bases: Enum
Enum for the request method.
Attributes:
| Name | Type | Description |
|---|---|---|
GET |
The GET method. |
|
POST |
The POST method. |
Source code in inference_sdk/http/utils/executors.py
34 35 36 37 38 39 40 41 42 43 | |
execute_requests_packages(requests_data, request_method, max_concurrent_requests)
¶
Execute a list of requests in parallel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requests_data
|
List[RequestData]
|
The list of requests to execute. |
required |
request_method
|
RequestMethod
|
The method to use for the requests. |
required |
max_concurrent_requests
|
int
|
The maximum number of concurrent requests. |
required |
Returns:
| Type | Description |
|---|---|
List[Response]
|
The list of responses. |
Source code in inference_sdk/http/utils/executors.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
execute_requests_packages_async(requests_data, request_method, max_concurrent_requests)
async
¶
Execute a list of requests in parallel asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requests_data
|
List[RequestData]
|
The list of requests to execute. |
required |
request_method
|
RequestMethod
|
The method to use for the requests. |
required |
max_concurrent_requests
|
int
|
The maximum number of concurrent requests. |
required |
Returns:
| Type | Description |
|---|---|
List[Union[dict, bytes]]
|
The list of responses. |
Source code in inference_sdk/http/utils/executors.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
make_parallel_requests(requests_data, request_method)
¶
Execute a list of requests in parallel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requests_data
|
List[RequestData]
|
The list of requests to execute. |
required |
request_method
|
RequestMethod
|
The method to use for the requests. |
required |
Returns:
| Type | Description |
|---|---|
List[Response]
|
The list of responses. |
Source code in inference_sdk/http/utils/executors.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
make_parallel_requests_async(requests_data, request_method)
async
¶
Execute a list of requests in parallel asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requests_data
|
List[RequestData]
|
The list of requests to execute. |
required |
request_method
|
RequestMethod
|
The method to use for the requests. |
required |
Returns:
| Type | Description |
|---|---|
List[Union[dict, bytes]]
|
The list of responses. |
Source code in inference_sdk/http/utils/executors.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
make_request(request_data, request_method)
¶
Make a request to the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_data
|
RequestData
|
The request data. |
required |
request_method
|
RequestMethod
|
The method to use for the request. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
The response from the API. |
Source code in inference_sdk/http/utils/executors.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
make_request_async(request_data, request_method, session)
async
¶
Make a request to the API asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_data
|
RequestData
|
The request data. |
required |
request_method
|
RequestMethod
|
The method to use for the request. |
required |
session
|
ClientSession
|
The session to use for the request. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, Union[bytes, dict]]
|
The response from the API. |
Source code in inference_sdk/http/utils/executors.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |
raise_client_error(details)
¶
Raise a client error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
details
|
dict
|
The details of the error. |
required |
Source code in inference_sdk/http/utils/executors.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
response_is_not_retryable_error(response)
¶
Check if the response is not a retryable error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response
|
ClientResponse
|
The response to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the response is not a retryable error, False otherwise. |
Source code in inference_sdk/http/utils/executors.py
307 308 309 310 311 312 313 314 315 316 | |