Experimental: multiprocessing for speeding up query map decodes. #84
+170
−63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Works (mostly) with the following snippet:
Note that during the
executor.shutdown
line, we get lots of EOF errors, and idk why:output
3.92362904548645 time elapsed: 19.864284992218018 Async Results 14803 Exception in thread Exception in thread Thread-2 (_monitor): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner Exception in thread Thread-2 (_monitor): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner Exception in thread Thread-2 (_monitor): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner Thread-2 (_monitor): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner Exception in thread Exception in thread Thread-2 (_monitor)Exception in thread Thread-2 (_monitor)Thread-2 (_monitor): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner : Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner Exception in thread : Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner Thread-2 (_monitor): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner Exception in thread Thread-2 (_monitor): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner Exception in thread Thread-2 (_monitor): Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner self.run() self.run() self.run()self.run() self.run() self.run() File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in runself.run() File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
self.run()
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
self.run()self._target(*self._args, **self._kwargs)
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)self._target(*self._args, **self._kwargs)self._target(*self._args, **self._kwargs)
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
self._target(*self._args, **self._kwargs)
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
self._target(*self._args, **self._kwargs)
self._target(*self._args, **self._kwargs)
self._target(*self._args, **self._kwargs)
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1577, in _monitor
record = self.dequeue(True)
record = self.dequeue(True) record = self.dequeue(True)
record = self.dequeue(True)
record = self.dequeue(True)record = self.dequeue(True)
^^
^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
^^^^^^^^^^^^^^^^^^^^^^^^^
^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
^^^
^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/logging/handlers.py", line 1526, in dequeue
return self.queue.get(block)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
return self.queue.get(block)
return self.queue.get(block)
return self.queue.get(block)return self.queue.get(block)
^^^ ^^^^^ ^ return self.queue.get(block)^ return self.queue.get(block)
return self.queue.get(block)
^
^^^ ^ ^ ^ ^ ^ ^ ^ ^^^ ^ ^
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^ ^^ ^^^^^ ^^ ^^^^^^^^^ ^^return self.queue.get(block)^
^ ^^^^ ^
^ ^ ^^^^^^^^^^ ^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^ ^^^^^^^^^
^ ^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^^^^ ^ ^^^^^^^^^^ ^^^ ^^^res = self._recv_bytes()
^^ ^res = self._recv_bytes()
^res = self._recv_bytes() File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^ ^ ^ ^ ^^^res = self._recv_bytes()^^^
^ ^
^^^^^^^^^ ^ ^^^ ^
res = self._recv_bytes() ^^ ^^^^^^^^^
^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^ ^ ^ ^ ^
^ ^ ^^ ^ ^res = self._recv_bytes()
^ ^
^^ ^^^
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^ ^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^^^^^^ ^^^^^^^^^^
^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^ ^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/queues.py", line 103, in get
^^^ ^^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
^res = self._recv_bytes()^ ^res = self._recv_bytes()^^^ ^
res = self._recv_bytes()^
^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
^ ^ ^ ^ ^^^^^ ^^ ^^ ^^^^ ^^^ ^^res = self._recv_bytes()^
^ ^^ ^^^^^^^^^^ ^ ^^ ^
^^^^^ ^ ^ ^ ^^^^^^^ ^ ^^ ^^^^^ ^ ^^
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
^
^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
^ ^^^^buf = self._recv_bytes(maxlength) ^
^buf = self._recv_bytes(maxlength)^
^^^
^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
^^buf = self._recv_bytes(maxlength)^^^
^^ buf = self._recv_bytes(maxlength)^
^^^^^ ^ ^^ ^ ^ buf = self._recv_bytes(maxlength)^^
^ ^ ^^ ^ ^
^^^^ ^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)^
^ ^ ^ ^ ^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 216, in recv_bytes
^^^^^^^^^^ ^buf = self._recv_bytes(maxlength)^^
^^^^^^^ ^ ^ ^ ^ ^^^buf = self._recv_bytes(maxlength)
^^^ ^ ^ ^^ ^^buf = self._recv_bytes(maxlength)
^^^^^^^^^^^ ^ ^^ ^^ ^ ^^ ^^buf = self._recv_bytes(maxlength)
^^ ^ ^ ^ ^^^ ^^ ^^ ^^ ^^^^^ ^ ^^ ^ ^
^ ^^ ^ ^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^^^^ ^ ^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^ ^^^^^^^^
^buf = self._recv(4)^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^^^^^
^^^^^^
^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^^^^^^^^^^ ^^^ ^^ ^^^ ^^^ ^^^
^ buf = self._recv(4)
^ ^^^^ ^^ ^^ ^ ^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^^^^ buf = self._recv(4)
^ ^^^^ ^ ^^ ^ ^^
^buf = self._recv(4)
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^^^^^^^^^^^^^^
^^ ^^
^ ^^^
^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^ ^ ^^buf = self._recv(4)^^^
^ ^buf = self._recv(4)^^
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
^^ ^ ^
^ ^^^^ ^^^ ^^ ^^ ^ ^^^^^^^
raise EOFError File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
^^EOFError^^
^^^ ^ ^^^^ ^
buf = self._recv(4) File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
raise EOFErrorEOFError^
^
^ ^^ ^EOFError
raise EOFError^^
^^ ^^^^^ ^ ^EOFError ^ ^ ^
^ ^^ ^^^^^^^^ ^ raise EOFError^�[0m
^^^^^
�[0m
^ File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
^
^^ EOFError^�[0m File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
^ ^^^^^^^^�[0m
^^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
raise EOFError
EOFError
^^^ raise EOFError
EOFError
^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
�[0m raise EOFError�[0m
raise EOFError
EOFError
EOFError
�[0m raise EOFError
EOFError
�[0m�[0m�[0m�[0m
Process finished with exit code 0