Skip to content

Commit

Permalink
Make nvqc_proxy.py multi-threaded (#1387)
Browse files Browse the repository at this point in the history
Full backstory and test details are in PR.
  • Loading branch information
bmhowe23 committed Mar 13, 2024
1 parent 35bade4 commit 3d4749b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/nvqc_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
QPUD_PORT = 3031 # see `docker/build/cudaq.nvqc.Dockerfile`


class ThreadedHTTPServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
"""Handle requests in a separate thread."""


class Server(http.server.SimpleHTTPRequestHandler):
protocol_version = 'HTTP/1.1'
default_request_version = 'HTTP/1.1'
Expand Down Expand Up @@ -85,7 +89,7 @@ def do_POST(self):


Handler = Server
with socketserver.TCPServer(("", PROXY_PORT), Handler) as httpd:
with ThreadedHTTPServer(("", PROXY_PORT), Handler) as httpd:
print("Serving at port", PROXY_PORT)
print("Forward to port", QPUD_PORT)
httpd.serve_forever()

0 comments on commit 3d4749b

Please sign in to comment.