in src/azstoragetorch/_client.py [0:0]
def _get_executor(self) -> concurrent.futures.Executor:
# We want executor creation to be lazy instead of instantiating immediately in
# the constructor because the executor itself is not pickleable. This is an issue
# when workers are used by PyTorch's DataLoader as workers are spawned as processes.
# So we delay executor creation until it is needed for reading/writing data which will
# happen after processes are spawned.
if self._executor is None:
self._executor = concurrent.futures.ThreadPoolExecutor(
self._max_in_flight_requests
)
return self._executor