Skip to content

Commit

Permalink
Set maxsize of request queue to Quantum Engine (#6576)
Browse files Browse the repository at this point in the history
* set maxsize for request queue

* add max message size
  • Loading branch information
senecameeks committed Apr 30, 2024
1 parent 37e8df9 commit 614c78a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ def __init__(
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
('grpc.max_send_message_length', 20 * 1024 * 1024), # 20MiB
('grpc.max_receive_message_length', -1), # unlimited
('grpc.max_metadata_length', 10 * 1024 * 1024), # 10MiB
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ def __init__(
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
('grpc.max_send_message_length', 20 * 1024 * 1024), # 20MiB
('grpc.max_receive_message_length', -1), # unlimited
('grpc.max_metadata_length', 10 * 1024 * 1024), # 10MiB
],
)

Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/stream_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async def _make_request_queue(self) -> asyncio.Queue[Optional[quantum.QuantumRun
If `None` is put into the queue, the request iterator will stop.
"""
return asyncio.Queue()
return asyncio.Queue(maxsize=100)

def submit(
self, project_name: str, program: quantum.QuantumProgram, job: quantum.QuantumJob
Expand Down

0 comments on commit 614c78a

Please sign in to comment.