Add more logs and asswert to qps_worker

pull/22992/head
Esun Kim 5 years ago
parent 83dd71dfe5
commit d45f877dfb
  1. 20
      test/cpp/qps/driver.cc
  2. 11
      test/cpp/qps/qps_worker.cc

@ -326,6 +326,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
if (server_config.core_limit() != 0) {
gpr_log(GPR_ERROR,
"server config core limit is set but ignored by driver");
GPR_ASSERT(false);
}
ServerArgs args;
@ -333,10 +334,12 @@ std::unique_ptr<ScenarioResult> RunScenario(
servers[i].stream = servers[i].stub->RunServer(alloc_context(&contexts));
if (!servers[i].stream->Write(args)) {
gpr_log(GPR_ERROR, "Could not write args to server %zu", i);
GPR_ASSERT(false);
}
ServerStatus init_status;
if (!servers[i].stream->Read(&init_status)) {
gpr_log(GPR_ERROR, "Server %zu did not yield initial status", i);
GPR_ASSERT(false);
}
if (qps_server_target_override.length() > 0) {
// overriding the qps server target only works if there is 1 server
@ -383,6 +386,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
if (initial_client_config.core_limit() != 0) {
gpr_log(GPR_ERROR, "client config core limit set but ignored");
GPR_ASSERT(false);
}
// Reduce channel count so that total channels specified is held regardless
@ -400,6 +404,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
clients[i].stream = clients[i].stub->RunClient(alloc_context(&contexts));
if (!clients[i].stream->Write(args)) {
gpr_log(GPR_ERROR, "Could not write args to client %zu", i);
GPR_ASSERT(false);
}
}
@ -407,6 +412,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
ClientStatus init_status;
if (!clients[i].stream->Read(&init_status)) {
gpr_log(GPR_ERROR, "Client %zu did not yield initial status", i);
GPR_ASSERT(false);
}
}
@ -423,12 +429,14 @@ std::unique_ptr<ScenarioResult> RunScenario(
auto client = &clients[i];
if (!client->stream->Write(client_mark)) {
gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i);
GPR_ASSERT(false);
}
}
for (size_t i = 0; i < num_clients; i++) {
auto client = &clients[i];
if (!client->stream->Read(&client_status)) {
gpr_log(GPR_ERROR, "Couldn't get status from client %zu", i);
GPR_ASSERT(false);
}
}
@ -444,24 +452,28 @@ std::unique_ptr<ScenarioResult> RunScenario(
auto server = &servers[i];
if (!server->stream->Write(server_mark)) {
gpr_log(GPR_ERROR, "Couldn't write mark to server %zu", i);
GPR_ASSERT(false);
}
}
for (size_t i = 0; i < num_clients; i++) {
auto client = &clients[i];
if (!client->stream->Write(client_mark)) {
gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i);
GPR_ASSERT(false);
}
}
for (size_t i = 0; i < num_servers; i++) {
auto server = &servers[i];
if (!server->stream->Read(&server_status)) {
gpr_log(GPR_ERROR, "Couldn't get status from server %zu", i);
GPR_ASSERT(false);
}
}
for (size_t i = 0; i < num_clients; i++) {
auto client = &clients[i];
if (!client->stream->Read(&client_status)) {
gpr_log(GPR_ERROR, "Couldn't get status from client %zu", i);
GPR_ASSERT(false);
}
}
@ -485,9 +497,11 @@ std::unique_ptr<ScenarioResult> RunScenario(
auto client = &clients[i];
if (!client->stream->Write(client_mark)) {
gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i);
GPR_ASSERT(false);
}
if (!client->stream->WritesDone()) {
gpr_log(GPR_ERROR, "Failed WritesDone for client %zu", i);
GPR_ASSERT(false);
}
}
gpr_log(GPR_INFO, "Finishing servers");
@ -495,9 +509,11 @@ std::unique_ptr<ScenarioResult> RunScenario(
auto server = &servers[i];
if (!server->stream->Write(server_mark)) {
gpr_log(GPR_ERROR, "Couldn't write mark to server %zu", i);
GPR_ASSERT(false);
}
if (!server->stream->WritesDone()) {
gpr_log(GPR_ERROR, "Failed WritesDone for server %zu", i);
GPR_ASSERT(false);
}
}
@ -517,6 +533,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
GPR_ASSERT(!client->stream->Read(&client_status));
} else {
gpr_log(GPR_ERROR, "Couldn't get final status from client %zu", i);
GPR_ASSERT(false);
}
}
for (size_t i = 0; i < num_clients; i++) {
@ -530,6 +547,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
if (!success) {
gpr_log(GPR_ERROR, "Client %zu had an error %s", i,
s.error_message().c_str());
GPR_ASSERT(false);
}
}
@ -552,6 +570,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
GPR_ASSERT(!server->stream->Read(&server_status));
} else {
gpr_log(GPR_ERROR, "Couldn't get final status from server %zu", i);
GPR_ASSERT(false);
}
}
for (size_t i = 0; i < num_servers; i++) {
@ -565,6 +584,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
if (!success) {
gpr_log(GPR_ERROR, "Server %zu had an error %s", i,
s.error_message().c_str());
GPR_ASSERT(false);
}
}

@ -108,6 +108,7 @@ class WorkerServiceImpl final : public WorkerService::Service {
Status RunClient(
ServerContext* ctx,
ServerReaderWriter<ClientStatus, ClientArgs>* stream) override {
gpr_log(GPR_INFO, "RunClient: Entering");
InstanceGuard g(this);
if (!g.Acquired()) {
return Status(StatusCode::RESOURCE_EXHAUSTED, "Client worker busy");
@ -122,6 +123,7 @@ class WorkerServiceImpl final : public WorkerService::Service {
Status RunServer(
ServerContext* ctx,
ServerReaderWriter<ServerStatus, ServerArgs>* stream) override {
gpr_log(GPR_INFO, "RunServer: Entering");
InstanceGuard g(this);
if (!g.Acquired()) {
return Status(StatusCode::RESOURCE_EXHAUSTED, "Server worker busy");
@ -287,6 +289,15 @@ QpsWorker::QpsWorker(int driver_port, int server_port,
builder->RegisterService(impl_.get());
server_ = builder->BuildAndStart();
if (server_ == nullptr) {
gpr_log(GPR_ERROR,
"QpsWorker: Fail to BuildAndStart(driver_port=%d, server_port=%d)",
driver_port, server_port);
} else {
gpr_log(GPR_INFO,
"QpsWorker: BuildAndStart(driver_port=%d, server_port=%d) done",
driver_port, server_port);
}
}
QpsWorker::~QpsWorker() {}

Loading…
Cancel
Save