Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
9f89107f
Commit
9f89107f
authored
8 years ago
by
Jan Tattermusch
Browse files
Options
Downloads
Patches
Plain Diff
better qps_json_driver message when QPS_WORKERS env is missing
parent
659ddda0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/cpp/qps/driver.cc
+31
-13
31 additions, 13 deletions
test/cpp/qps/driver.cc
with
31 additions
and
13 deletions
test/cpp/qps/driver.cc
+
31
−
13
View file @
9f89107f
...
...
@@ -44,6 +44,7 @@
#include
<grpc/support/alloc.h>
#include
<grpc/support/host_port.h>
#include
<grpc/support/log.h>
#include
<grpc/support/string_util.h>
#include
"src/core/lib/profiling/timers.h"
#include
"src/core/lib/support/env.h"
...
...
@@ -99,23 +100,36 @@ static std::unordered_map<string, std::deque<int>> get_hosts_and_cores(
return
hosts
;
}
static
deque
<
string
>
get_workers
(
const
string
&
name
)
{
char
*
env
=
gpr_getenv
(
name
.
c_str
());
if
(
!
env
||
strlen
(
env
)
==
0
)
return
deque
<
string
>
();
static
deque
<
string
>
get_workers
(
const
string
&
env_name
)
{
char
*
env
=
gpr_getenv
(
env_name
.
c_str
());
if
(
!
env
)
{
env
=
gpr_strdup
(
""
);
}
deque
<
string
>
out
;
char
*
p
=
env
;
for
(;;)
{
char
*
comma
=
strchr
(
p
,
','
);
if
(
comma
)
{
out
.
emplace_back
(
p
,
comma
);
p
=
comma
+
1
;
}
else
{
out
.
emplace_back
(
p
);
gpr_free
(
env
);
return
out
;
if
(
strlen
(
env
)
!=
0
)
{
for
(;;)
{
char
*
comma
=
strchr
(
p
,
','
);
if
(
comma
)
{
out
.
emplace_back
(
p
,
comma
);
p
=
comma
+
1
;
}
else
{
out
.
emplace_back
(
p
);
break
;
}
}
}
if
(
out
.
size
()
==
0
)
{
gpr_log
(
GPR_ERROR
,
"Environment variable
\"
%s
\"
does not contain a list of QPS "
"workers to use. Set it to a comma-separated list of "
"hostname:port pairs, starting with hosts that should act as "
"servers. E.g. export "
"%s=
\"
serverhost1:1234,clienthost1:1234,clienthost2:1234
\"
"
,
env_name
.
c_str
(),
env_name
.
c_str
());
}
gpr_free
(
env
);
return
out
;
}
// helpers for postprocess_scenario_result
...
...
@@ -241,6 +255,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
workers
.
push_back
(
addr
);
}
}
GPR_ASSERT
(
workers
.
size
()
!=
0
);
// if num_clients is set to <=0, do dynamic sizing: all workers
// except for servers are clients
...
...
@@ -560,6 +575,9 @@ bool RunQuit() {
// Get client, server lists
bool
result
=
true
;
auto
workers
=
get_workers
(
"QPS_WORKERS"
);
if
(
workers
.
size
()
==
0
)
{
return
false
;
}
for
(
size_t
i
=
0
;
i
<
workers
.
size
();
i
++
)
{
auto
stub
=
WorkerService
::
NewStub
(
CreateChannel
(
workers
[
i
],
InsecureChannelCredentials
()));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment