Skip to content

Commit

Permalink
fix: remove return type for in place reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
Girish Chandrashekar committed Nov 7, 2022
1 parent 068ebb9 commit f35c4ce
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion jina/serve/networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,6 @@ async def task_wrapper():
connection_list=connections,
)
if error:
print(f'--->returning error: {type(error)}')
return error

return asyncio.create_task(task_wrapper())
Expand Down
4 changes: 1 addition & 3 deletions jina/serve/runtimes/gateway/graph/topology_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ async def _wait_previous_and_send(
need_copy=not copy_request_at_send
)
if self._reduce and len(self.parts_to_send) > 1:
self.parts_to_send = [
WorkerRequestHandler.reduce_requests(self.parts_to_send)
]
WorkerRequestHandler.reduce_requests(self.parts_to_send)

# avoid sending to executor which does not bind to this endpoint
if endpoint is not None and executor_endpoint_mapping is not None:
Expand Down
3 changes: 2 additions & 1 deletion jina/serve/runtimes/head/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ async def _handle_data_request(
else:
response_request, uses_after_metadata = result
elif len(worker_results) > 1 and self._reduce:
response_request = WorkerRequestHandler.reduce_requests(worker_results)
# reduce in place
WorkerRequestHandler.reduce_requests(worker_results)
elif len(worker_results) > 1 and not self._reduce:
# worker returned multiple responses, but the head is configured to skip reduction
# just concatenate the docs in this case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,5 +463,3 @@ def reduce_requests(requests: List['DataRequest']) -> 'DataRequest':

params = WorkerRequestHandler.get_parameters_dict_from_request(requests)
WorkerRequestHandler.replace_parameters(requests[0], params)

return requests[0]

0 comments on commit f35c4ce

Please sign in to comment.