Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fallback] Make the get_stats timeout configurable and default to 5m #148

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions framework/helpers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import datetime
import logging
import math
import pathlib
import threading
import time
Expand Down Expand Up @@ -260,6 +259,7 @@ def __init__(
name: str,
url: str,
image: str,
stats_request_timeout_s: str,
):
super().__init__(
manager=manager,
Expand All @@ -278,13 +278,14 @@ def __init__(
}
},
)
self.stats_request_timeout_s = stats_request_timeout_s

def get_stats(self, num_rpcs: int):
logger.debug("Sending %d requests", num_rpcs)
stub = test_pb2_grpc.LoadBalancerStatsServiceStub(self.channel())
res = stub.GetClientStats(
messages_pb2.LoadBalancerStatsRequest(
num_rpcs=num_rpcs, timeout_sec=math.ceil(num_rpcs * 10)
num_rpcs=num_rpcs, timeout_sec=self.stats_request_timeout_s
)
)
return res
Expand Down
7 changes: 6 additions & 1 deletion tests/fallback_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
_STATUS_POLL_INTERVAL_MS = flags.DEFINE_integer(
"status_poll_interval_ms", 300, "Channel status poll interval (in ms)"
)

_STATS_REQUEST_TIMEOUT_S = flags.DEFINE_integer(
"stats_request_timeout_s",
300,
"Number of seconds the client will wait for the requested number of RPCs",
)
_LISTENER = "listener_0"

absl.flags.adopt_module_key_flags(framework.xds_k8s_testcase)
Expand Down Expand Up @@ -92,6 +96,7 @@ def start_client(self, port: int = None, name: str = None):
port=port or get_free_port(),
url=f"xds:///{_LISTENER}",
image=framework.xds_k8s_flags.CLIENT_IMAGE.value,
stats_request_timeout_s=_STATS_REQUEST_TIMEOUT_S.value,
)

def start_control_plane(
Expand Down
Loading