-
Notifications
You must be signed in to change notification settings - Fork 406
Description
Describe the bug
Starting the axon service with the latest version bittensor==9.9.0 does not support concurrent processing of tasks sent by the validator; it is serial. The historical version bittensor==6.9.4 supported concurrent execution.
To Reproduce
I wrote a simple test code:
import bittensor as bt
import time
import datetime
def log(message):
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-3]
print(f"[{timestamp}] {message}")
class MySynapse( bt.Synapse ):
input: int = 1
output: int = 0
def handle_pow_request(synapse: MySynapse) -> MySynapse:
log(f"Processing request with input: {synapse.input}")
try:
result = 2**synapse.input
time.sleep(1)
synapse.output = result
log(f"Completed processing, output: {synapse.output}")
except Exception as e:
log(f"Error in processing: {e}")
synapse.output = 0
return synapse
my_axon = bt.axon(port=9090, ip="127.0.0.1",)
my_axon.attach(
forward_fn = handle_pow_request, verify_fn = None, blacklist_fn = None, priority_fn = None
)
my_axon.start()
try:
log("Server is running. Press Ctrl+C to stop.")
while True:
time.sleep(10)
except KeyboardInterrupt:
log("Server stopped.")
my_axon.stop()
log("Server shutdown complete.")
Then send 10 tasks at the same time, and the execution logs are as follows:
[2025-08-22 08:08:16.921] Server is running. Press Ctrl+C to stop.
[2025-08-22 08:08:27.904] Processing request with input: 4
[2025-08-22 08:08:28.905] Completed processing, output: 16
[2025-08-22 08:08:28.962] Processing request with input: 11
[2025-08-22 08:08:29.962] Completed processing, output: 2048
[2025-08-22 08:08:29.986] Processing request with input: 3
[2025-08-22 08:08:30.986] Completed processing, output: 8
[2025-08-22 08:08:31.009] Processing request with input: 13
[2025-08-22 08:08:32.009] Completed processing, output: 8192
[2025-08-22 08:08:32.037] Processing request with input: 18
[2025-08-22 08:08:33.037] Completed processing, output: 262144
[2025-08-22 08:08:33.060] Processing request with input: 15
[2025-08-22 08:08:34.061] Completed processing, output: 32768
[2025-08-22 08:08:34.084] Processing request with input: 11
[2025-08-22 08:08:35.084] Completed processing, output: 2048
[2025-08-22 08:08:35.108] Processing request with input: 17
[2025-08-22 08:08:36.108] Completed processing, output: 131072
[2025-08-22 08:08:36.131] Processing request with input: 5
[2025-08-22 08:08:37.131] Completed processing, output: 32
[2025-08-22 08:08:37.154] Processing request with input: 2
[2025-08-22 08:08:38.154] Completed processing, output: 4
Expected behavior
How should I modify the code so that these 10 tasks can be executed concurrently?
Screenshots
No response
Environment
bittensor==9.9.0
Additional context
No response