Skip to content

Commit a51e5ee

Browse files
authored
fix: fix req handling sagemaker (#6218)
1 parent 425e5ea commit a51e5ee

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

jina/serve/runtimes/worker/request_handling.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,18 @@ def _init_batchqueue_dict(self):
292292
func.fn.__name__: [] for func in self._executor.requests.values()
293293
}
294294
for endpoint, func in self._executor.requests.items():
295-
func_endpoints[func.fn.__name__].append(endpoint)
295+
if func.fn.__name__ in func_endpoints:
296+
# For SageMaker, not all endpoints are there
297+
func_endpoints[func.fn.__name__].append(endpoint)
296298
for func_name, dbatch_config in dbatch_functions:
297-
for endpoint in func_endpoints[func_name]:
298-
if endpoint not in self._batchqueue_config:
299-
self._batchqueue_config[endpoint] = dbatch_config
300-
else:
301-
# we need to eventually copy the `custom_metric`
302-
if dbatch_config.get('custom_metric', None) is not None:
303-
self._batchqueue_config[endpoint]['custom_metric'] = dbatch_config.get('custom_metric')
299+
if func_name in func_endpoints: # For SageMaker, not all endpoints are there
300+
for endpoint in func_endpoints[func_name]:
301+
if endpoint not in self._batchqueue_config:
302+
self._batchqueue_config[endpoint] = dbatch_config
303+
else:
304+
# we need to eventually copy the `custom_metric`
305+
if dbatch_config.get('custom_metric', None) is not None:
306+
self._batchqueue_config[endpoint]['custom_metric'] = dbatch_config.get('custom_metric')
304307

305308
keys_to_remove = []
306309
for k, batch_config in self._batchqueue_config.items():

0 commit comments

Comments
 (0)