Skip to content

Commit

Permalink
remove futures from client
Browse files Browse the repository at this point in the history
Signed-off-by: Praneeth Bedapudi <[email protected]>
  • Loading branch information
bedapudi6788 committed Oct 3, 2024
1 parent 7fca325 commit bb38874
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
26 changes: 0 additions & 26 deletions clients/python/fdclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import time
import json

import concurrent.futures as futures


class FDClient:
def __init__(self, server_url, compression=True, request_timeout=None):
Expand Down Expand Up @@ -67,15 +65,6 @@ def _decompressor(self):
self.local_storage.decompressor = zstandard.ZstdDecompressor()
return self.local_storage.decompressor

@property
def _thread_pool_executor(self):
if (
not hasattr(self.local_storage, "thread_pool_executor")
or self.local_storage.thread_pool_executor is None
):
self.local_storage.thread_pool_executor = futures.ThreadPoolExecutor(32)
return self.local_storage.thread_pool_executor

@property
def _decompressor(self):
if self.compression is False:
Expand Down Expand Up @@ -137,21 +126,6 @@ def infer(self, data, unique_id=None, is_async=False):
def infer_async(self, data, unique_id=None):
return self.infer(data, unique_id, is_async=True)

def infer_background(self, data, unique_id=None):
return self._thread_pool_executor.submit(self.infer, data, unique_id)

def infer_background_multiple(self, data_list, unique_ids=None):
return [
self.infer_background(data, unique_ids[i] if unique_ids else None)
for i, data in enumerate(data_list)
]

def __close__(self):
self._thread_pool_executor.shutdown(wait=False, cancel_futures=True)

def __del__(self):
self.__close__()


if __name__ == "__main__":
client = FDClient("http://localhost:8080")
Expand Down
2 changes: 1 addition & 1 deletion clients/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
EMAIL = "[email protected]"
AUTHOR = "BEDAPUDI PRANEETH"
REQUIRES_PYTHON = ">=3.6.0"
VERSION = "3.0.5"
VERSION = "3.0.6"

# What packages are required for this module to be executed?
REQUIRED = ["zstandard", "requests", "msgpack"]
Expand Down

0 comments on commit bb38874

Please sign in to comment.