erge branch 'master' of https://github.com/grpc/grpc into channelz

pull/16819/head
ncteisen 6 years ago
commit afe56fd849
  1. 1
      CMakeLists.txt
  2. 3
      Makefile
  3. 1
      build.yaml
  4. 1
      grpc.gyp
  5. 1
      requirements.bazel.txt
  6. 6
      src/core/lib/iomgr/tcp_posix.cc
  7. 8
      src/proto/grpc/reflection/v1alpha/BUILD
  8. 34
      src/proto/grpc/testing/BUILD
  9. 1
      src/proto/grpc/testing/control.proto
  10. 30
      src/proto/grpc/testing/proto2/BUILD.bazel
  11. 34
      src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel
  12. 97
      src/python/grpcio_tests/tests/interop/BUILD.bazel
  13. 9
      src/python/grpcio_tests/tests/interop/credentials/BUILD.bazel
  14. 21
      src/python/grpcio_tests/tests/reflection/BUILD.bazel
  15. 1
      test/cpp/qps/BUILD
  16. 1
      test/cpp/qps/client.h
  17. 219
      test/cpp/qps/client_callback.cc
  18. 2
      test/cpp/qps/qps_worker.cc
  19. 1
      tools/run_tests/generated/sources_and_headers.json
  20. 6
      tools/run_tests/run_interop_tests.py

@ -5249,6 +5249,7 @@ add_library(qps
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/worker_service.grpc.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/worker_service.grpc.pb.h
test/cpp/qps/benchmark_config.cc test/cpp/qps/benchmark_config.cc
test/cpp/qps/client_async.cc test/cpp/qps/client_async.cc
test/cpp/qps/client_callback.cc
test/cpp/qps/client_sync.cc test/cpp/qps/client_sync.cc
test/cpp/qps/driver.cc test/cpp/qps/driver.cc
test/cpp/qps/parse_json.cc test/cpp/qps/parse_json.cc

@ -7510,6 +7510,7 @@ LIBQPS_SRC = \
$(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc \
test/cpp/qps/benchmark_config.cc \ test/cpp/qps/benchmark_config.cc \
test/cpp/qps/client_async.cc \ test/cpp/qps/client_async.cc \
test/cpp/qps/client_callback.cc \
test/cpp/qps/client_sync.cc \ test/cpp/qps/client_sync.cc \
test/cpp/qps/driver.cc \ test/cpp/qps/driver.cc \
test/cpp/qps/parse_json.cc \ test/cpp/qps/parse_json.cc \
@ -7566,6 +7567,7 @@ endif
endif endif
$(OBJDIR)/$(CONFIG)/test/cpp/qps/benchmark_config.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/benchmark_config.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc
$(OBJDIR)/$(CONFIG)/test/cpp/qps/client_async.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/client_async.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc
$(OBJDIR)/$(CONFIG)/test/cpp/qps/client_callback.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc
$(OBJDIR)/$(CONFIG)/test/cpp/qps/client_sync.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/client_sync.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc
$(OBJDIR)/$(CONFIG)/test/cpp/qps/driver.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/driver.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc
$(OBJDIR)/$(CONFIG)/test/cpp/qps/parse_json.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/parse_json.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.pb.cc $(GENDIR)/src/proto/grpc/testing/benchmark_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.pb.cc $(GENDIR)/src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.pb.cc $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc
@ -24917,6 +24919,7 @@ test/cpp/interop/server_helper.cc: $(OPENSSL_DEP)
test/cpp/microbenchmarks/helpers.cc: $(OPENSSL_DEP) test/cpp/microbenchmarks/helpers.cc: $(OPENSSL_DEP)
test/cpp/qps/benchmark_config.cc: $(OPENSSL_DEP) test/cpp/qps/benchmark_config.cc: $(OPENSSL_DEP)
test/cpp/qps/client_async.cc: $(OPENSSL_DEP) test/cpp/qps/client_async.cc: $(OPENSSL_DEP)
test/cpp/qps/client_callback.cc: $(OPENSSL_DEP)
test/cpp/qps/client_sync.cc: $(OPENSSL_DEP) test/cpp/qps/client_sync.cc: $(OPENSSL_DEP)
test/cpp/qps/driver.cc: $(OPENSSL_DEP) test/cpp/qps/driver.cc: $(OPENSSL_DEP)
test/cpp/qps/parse_json.cc: $(OPENSSL_DEP) test/cpp/qps/parse_json.cc: $(OPENSSL_DEP)

@ -1965,6 +1965,7 @@ libs:
- src/proto/grpc/testing/worker_service.proto - src/proto/grpc/testing/worker_service.proto
- test/cpp/qps/benchmark_config.cc - test/cpp/qps/benchmark_config.cc
- test/cpp/qps/client_async.cc - test/cpp/qps/client_async.cc
- test/cpp/qps/client_callback.cc
- test/cpp/qps/client_sync.cc - test/cpp/qps/client_sync.cc
- test/cpp/qps/driver.cc - test/cpp/qps/driver.cc
- test/cpp/qps/parse_json.cc - test/cpp/qps/parse_json.cc

@ -1717,6 +1717,7 @@
'src/proto/grpc/testing/worker_service.proto', 'src/proto/grpc/testing/worker_service.proto',
'test/cpp/qps/benchmark_config.cc', 'test/cpp/qps/benchmark_config.cc',
'test/cpp/qps/client_async.cc', 'test/cpp/qps/client_async.cc',
'test/cpp/qps/client_callback.cc',
'test/cpp/qps/client_sync.cc', 'test/cpp/qps/client_sync.cc',
'test/cpp/qps/driver.cc', 'test/cpp/qps/driver.cc',
'test/cpp/qps/parse_json.cc', 'test/cpp/qps/parse_json.cc',

@ -8,4 +8,3 @@ wheel>=0.29
futures>=2.2.0 futures>=2.2.0
google-auth>=1.0.0 google-auth>=1.0.0
oauth2client==4.1.0 oauth2client==4.1.0
requests>=2.14.2

@ -468,7 +468,9 @@ static void tcp_do_read(grpc_tcp* tcp) {
GRPC_STATS_INC_TCP_READ_SIZE(read_bytes); GRPC_STATS_INC_TCP_READ_SIZE(read_bytes);
add_to_estimate(tcp, static_cast<size_t>(read_bytes)); add_to_estimate(tcp, static_cast<size_t>(read_bytes));
GPR_ASSERT((size_t)read_bytes <= tcp->incoming_buffer->length); GPR_ASSERT((size_t)read_bytes <= tcp->incoming_buffer->length);
if (static_cast<size_t>(read_bytes) < tcp->incoming_buffer->length) { if (static_cast<size_t>(read_bytes) == tcp->incoming_buffer->length) {
finish_estimate(tcp);
} else if (static_cast<size_t>(read_bytes) < tcp->incoming_buffer->length) {
grpc_slice_buffer_trim_end( grpc_slice_buffer_trim_end(
tcp->incoming_buffer, tcp->incoming_buffer,
tcp->incoming_buffer->length - static_cast<size_t>(read_bytes), tcp->incoming_buffer->length - static_cast<size_t>(read_bytes),
@ -498,7 +500,7 @@ static void tcp_read_allocation_done(void* tcpp, grpc_error* error) {
static void tcp_continue_read(grpc_tcp* tcp) { static void tcp_continue_read(grpc_tcp* tcp) {
size_t target_read_size = get_target_read_size(tcp); size_t target_read_size = get_target_read_size(tcp);
if (tcp->incoming_buffer->length < target_read_size && if (tcp->incoming_buffer->length < target_read_size / 2 &&
tcp->incoming_buffer->count < MAX_READ_IOVEC) { tcp->incoming_buffer->count < MAX_READ_IOVEC) {
if (grpc_tcp_trace.enabled()) { if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_INFO, "TCP:%p alloc_slices", tcp); gpr_log(GPR_INFO, "TCP:%p alloc_slices", tcp);

@ -22,11 +22,3 @@ grpc_proto_library(
name = "reflection_proto", name = "reflection_proto",
srcs = ["reflection.proto"], srcs = ["reflection.proto"],
) )
filegroup(
name = "reflection_proto_file",
srcs = [
"reflection.proto",
],
)

@ -15,8 +15,6 @@
licenses(["notice"]) # Apache v2 licenses(["notice"]) # Apache v2
load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_library")
grpc_package(name = "testing", visibility = "public") grpc_package(name = "testing", visibility = "public")
@ -60,30 +58,12 @@ grpc_proto_library(
has_services = False, has_services = False,
) )
py_proto_library(
name = "py_empty_proto",
protos = ["empty.proto",],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)
grpc_proto_library( grpc_proto_library(
name = "messages_proto", name = "messages_proto",
srcs = ["messages.proto"], srcs = ["messages.proto"],
has_services = False, has_services = False,
) )
py_proto_library(
name = "py_messages_proto",
protos = ["messages.proto",],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)
grpc_proto_library( grpc_proto_library(
name = "metrics_proto", name = "metrics_proto",
srcs = ["metrics.proto"], srcs = ["metrics.proto"],
@ -136,17 +116,3 @@ grpc_proto_library(
"messages_proto", "messages_proto",
], ],
) )
py_proto_library(
name = "py_test_proto",
protos = ["test.proto",],
with_grpc = True,
deps = [
requirement('protobuf'),
],
proto_deps = [
":py_empty_proto",
":py_messages_proto",
]
)

@ -25,6 +25,7 @@ enum ClientType {
SYNC_CLIENT = 0; SYNC_CLIENT = 0;
ASYNC_CLIENT = 1; ASYNC_CLIENT = 1;
OTHER_CLIENT = 2; // used for some language-specific variants OTHER_CLIENT = 2; // used for some language-specific variants
CALLBACK_CLIENT = 3;
} }
enum ServerType { enum ServerType {

@ -1,30 +0,0 @@
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_library")
package(default_visibility = ["//visibility:public"])
py_proto_library(
name = "empty2_proto",
protos = [
"empty2.proto",
],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)
py_proto_library(
name = "empty2_extensions_proto",
protos = [
"empty2_extensions.proto",
],
proto_deps = [
":empty2_proto",
],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)

@ -1,34 +0,0 @@
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_library")
package(default_visibility = ["//visibility:public"])
genrule(
name = "mv_reflection_proto",
srcs = [
"//src/proto/grpc/reflection/v1alpha:reflection_proto_file",
],
outs = ["reflection.proto",],
cmd = "cp $< $@",
)
py_proto_library(
name = "py_reflection_proto",
protos = [":mv_reflection_proto",],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)
py_library(
name = "grpc_reflection",
srcs = ["reflection.py",],
deps = [
":py_reflection_proto",
"//src/python/grpcio/grpc:grpcio",
requirement('protobuf'),
],
imports=["../../",],
)

@ -1,97 +0,0 @@
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_visibility = ["//visibility:public"])
py_library(
name = "_intraop_test_case",
srcs = ["_intraop_test_case.py"],
deps = [
":methods",
],
imports=["../../",],
)
py_library(
name = "client",
srcs = ["client.py"],
deps = [
"//src/python/grpcio/grpc:grpcio",
":methods",
":resources",
"//src/proto/grpc/testing:py_test_proto",
requirement('google-auth'),
],
imports=["../../",],
)
py_library(
name = "methods",
srcs = ["methods.py"],
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/proto/grpc/testing:py_empty_proto",
"//src/proto/grpc/testing:py_messages_proto",
"//src/proto/grpc/testing:py_test_proto",
requirement('google-auth'),
requirement('requests'),
requirement('enum34'),
],
imports=["../../",],
)
py_library(
name = "resources",
srcs = ["resources.py"],
data = [
"//src/python/grpcio_tests/tests/interop/credentials",
],
)
py_library(
name = "server",
srcs = ["server.py"],
deps = [
"//src/python/grpcio/grpc:grpcio",
":methods",
":resources",
"//src/python/grpcio_tests/tests/unit:test_common",
"//src/proto/grpc/testing:py_test_proto",
],
imports=["../../",],
)
py_test(
name="_insecure_intraop_test",
size="small",
srcs=["_insecure_intraop_test.py",],
main="_insecure_intraop_test.py",
deps=[
"//src/python/grpcio/grpc:grpcio",
":_intraop_test_case",
":methods",
":server",
"//src/python/grpcio_tests/tests/unit:test_common",
"//src/proto/grpc/testing:py_test_proto",
],
imports=["../../",],
data=[
"//src/python/grpcio_tests/tests/unit/credentials",
],
)
py_test(
name="_secure_intraop_test",
size="small",
srcs=["_secure_intraop_test.py",],
main="_secure_intraop_test.py",
deps=[
"//src/python/grpcio/grpc:grpcio",
":_intraop_test_case",
":methods",
":server",
"//src/python/grpcio_tests/tests/unit:test_common",
"//src/proto/grpc/testing:py_test_proto",
],
imports=["../../",],
)

@ -1,9 +0,0 @@
package(default_visibility = ["//visibility:public"])
filegroup(
name="credentials",
srcs=glob([
"**",
]),
)

@ -1,21 +0,0 @@
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_visibility = ["//visibility:public"])
py_test(
name="_reflection_servicer_test",
size="small",
timeout="moderate",
srcs=["_reflection_servicer_test.py",],
main="_reflection_servicer_test.py",
deps=[
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_reflection/grpc_reflection/v1alpha:grpc_reflection",
"//src/python/grpcio_tests/tests/unit:test_common",
"//src/proto/grpc/testing:py_empty_proto",
"//src/proto/grpc/testing/proto2:empty2_extensions_proto",
requirement('protobuf'),
],
imports=["../../",],
)

@ -31,6 +31,7 @@ grpc_cc_library(
name = "qps_worker_impl", name = "qps_worker_impl",
srcs = [ srcs = [
"client_async.cc", "client_async.cc",
"client_callback.cc",
"client_sync.cc", "client_sync.cc",
"qps_server_builder.cc", "qps_server_builder.cc",
"qps_worker.cc", "qps_worker.cc",

@ -533,6 +533,7 @@ class ClientImpl : public Client {
std::unique_ptr<Client> CreateSynchronousClient(const ClientConfig& args); std::unique_ptr<Client> CreateSynchronousClient(const ClientConfig& args);
std::unique_ptr<Client> CreateAsyncClient(const ClientConfig& args); std::unique_ptr<Client> CreateAsyncClient(const ClientConfig& args);
std::unique_ptr<Client> CreateCallbackClient(const ClientConfig& args);
std::unique_ptr<Client> CreateGenericAsyncStreamingClient( std::unique_ptr<Client> CreateGenericAsyncStreamingClient(
const ClientConfig& args); const ClientConfig& args);

@ -0,0 +1,219 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <list>
#include <memory>
#include <mutex>
#include <sstream>
#include <string>
#include <thread>
#include <utility>
#include <vector>
#include <grpc/grpc.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
#include <grpcpp/alarm.h>
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
#include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
#include "test/cpp/qps/client.h"
#include "test/cpp/qps/usage_timer.h"
namespace grpc {
namespace testing {
/**
* Maintains context info per RPC
*/
struct CallbackClientRpcContext {
CallbackClientRpcContext(BenchmarkService::Stub* stub) : stub_(stub) {}
~CallbackClientRpcContext() {}
SimpleResponse response_;
ClientContext context_;
Alarm alarm_;
BenchmarkService::Stub* stub_;
};
static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
const std::shared_ptr<Channel>& ch) {
return BenchmarkService::NewStub(ch);
}
class CallbackClient
: public ClientImpl<BenchmarkService::Stub, SimpleRequest> {
public:
CallbackClient(const ClientConfig& config)
: ClientImpl<BenchmarkService::Stub, SimpleRequest>(
config, BenchmarkStubCreator) {
num_threads_ = NumThreads(config);
rpcs_done_ = 0;
SetupLoadTest(config, num_threads_);
total_outstanding_rpcs_ =
config.client_channels() * config.outstanding_rpcs_per_channel();
}
virtual ~CallbackClient() {}
protected:
size_t num_threads_;
size_t total_outstanding_rpcs_;
// The below mutex and condition variable is used by main benchmark thread to
// wait on completion of all RPCs before shutdown
std::mutex shutdown_mu_;
std::condition_variable shutdown_cv_;
// Number of rpcs done after thread completion
size_t rpcs_done_;
// Vector of Context data pointers for running a RPC
std::vector<std::unique_ptr<CallbackClientRpcContext>> ctx_;
virtual void InitThreadFuncImpl(size_t thread_idx) = 0;
virtual bool ThreadFuncImpl(Thread* t, size_t thread_idx) = 0;
void ThreadFunc(size_t thread_idx, Thread* t) override {
InitThreadFuncImpl(thread_idx);
ThreadFuncImpl(t, thread_idx);
}
virtual void ScheduleRpc(Thread* t, size_t thread_idx,
size_t ctx_vector_idx) = 0;
/**
* The main thread of the benchmark will be waiting on DestroyMultithreading.
* Increment the rpcs_done_ variable to signify that the Callback RPC
* after thread completion is done. When the last outstanding rpc increments
* the counter it should also signal the main thread's conditional variable.
*/
void NotifyMainThreadOfThreadCompletion() {
std::lock_guard<std::mutex> l(shutdown_mu_);
rpcs_done_++;
if (rpcs_done_ == total_outstanding_rpcs_) {
shutdown_cv_.notify_one();
}
}
private:
int NumThreads(const ClientConfig& config) {
int num_threads = config.async_client_threads();
if (num_threads <= 0) { // Use dynamic sizing
num_threads = cores_;
gpr_log(GPR_INFO, "Sizing callback client to %d threads", num_threads);
}
return num_threads;
}
/**
* Wait until all outstanding Callback RPCs are done
*/
void DestroyMultithreading() final {
std::unique_lock<std::mutex> l(shutdown_mu_);
while (rpcs_done_ != total_outstanding_rpcs_) {
shutdown_cv_.wait(l);
}
EndThreads();
}
};
class CallbackUnaryClient final : public CallbackClient {
public:
CallbackUnaryClient(const ClientConfig& config) : CallbackClient(config) {
for (int ch = 0; ch < config.client_channels(); ch++) {
for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) {
ctx_.emplace_back(
new CallbackClientRpcContext(channels_[ch].get_stub()));
}
}
StartThreads(num_threads_);
}
~CallbackUnaryClient() {}
protected:
bool ThreadFuncImpl(Thread* t, size_t thread_idx) override {
for (size_t vector_idx = thread_idx; vector_idx < total_outstanding_rpcs_;
vector_idx += num_threads_) {
ScheduleRpc(t, thread_idx, vector_idx);
}
return true;
}
void InitThreadFuncImpl(size_t thread_idx) override { return; }
private:
void ScheduleRpc(Thread* t, size_t thread_idx, size_t vector_idx) override {
if (!closed_loop_) {
gpr_timespec next_issue_time = NextIssueTime(thread_idx);
// Start an alarm callback to run the internal callback after
// next_issue_time
ctx_[vector_idx]->alarm_.experimental().Set(
next_issue_time, [this, t, thread_idx, vector_idx](bool ok) {
IssueUnaryCallbackRpc(t, thread_idx, vector_idx);
});
} else {
IssueUnaryCallbackRpc(t, thread_idx, vector_idx);
}
}
void IssueUnaryCallbackRpc(Thread* t, size_t thread_idx, size_t vector_idx) {
GPR_TIMER_SCOPE("CallbackUnaryClient::ThreadFunc", 0);
double start = UsageTimer::Now();
ctx_[vector_idx]->stub_->experimental_async()->UnaryCall(
(&ctx_[vector_idx]->context_), &request_, &ctx_[vector_idx]->response_,
[this, t, thread_idx, start, vector_idx](grpc::Status s) {
// Update Histogram with data from the callback run
HistogramEntry entry;
if (s.ok()) {
entry.set_value((UsageTimer::Now() - start) * 1e9);
}
entry.set_status(s.error_code());
t->UpdateHistogram(&entry);
if (ThreadCompleted() || !s.ok()) {
// Notify thread of completion
NotifyMainThreadOfThreadCompletion();
} else {
// Reallocate ctx for next RPC
ctx_[vector_idx].reset(
new CallbackClientRpcContext(ctx_[vector_idx]->stub_));
// Schedule a new RPC
ScheduleRpc(t, thread_idx, vector_idx);
}
});
}
};
std::unique_ptr<Client> CreateCallbackClient(const ClientConfig& config) {
switch (config.rpc_type()) {
case UNARY:
return std::unique_ptr<Client>(new CallbackUnaryClient(config));
case STREAMING:
case STREAMING_FROM_CLIENT:
case STREAMING_FROM_SERVER:
case STREAMING_BOTH_WAYS:
assert(false);
return nullptr;
default:
assert(false);
return nullptr;
}
}
} // namespace testing
} // namespace grpc

@ -60,6 +60,8 @@ static std::unique_ptr<Client> CreateClient(const ClientConfig& config) {
return config.payload_config().has_bytebuf_params() return config.payload_config().has_bytebuf_params()
? CreateGenericAsyncStreamingClient(config) ? CreateGenericAsyncStreamingClient(config)
: CreateAsyncClient(config); : CreateAsyncClient(config);
case ClientType::CALLBACK_CLIENT:
return CreateCallbackClient(config);
default: default:
abort(); abort();
} }

@ -7836,6 +7836,7 @@
"test/cpp/qps/benchmark_config.h", "test/cpp/qps/benchmark_config.h",
"test/cpp/qps/client.h", "test/cpp/qps/client.h",
"test/cpp/qps/client_async.cc", "test/cpp/qps/client_async.cc",
"test/cpp/qps/client_callback.cc",
"test/cpp/qps/client_sync.cc", "test/cpp/qps/client_sync.cc",
"test/cpp/qps/driver.cc", "test/cpp/qps/driver.cc",
"test/cpp/qps/driver.h", "test/cpp/qps/driver.h",

@ -778,7 +778,7 @@ def cloud_to_prod_jobspec(language,
if transport_security == 'tls': if transport_security == 'tls':
transport_security_options = ['--use_tls=true'] transport_security_options = ['--use_tls=true']
elif transport_security == 'google_default_credentials' and str( elif transport_security == 'google_default_credentials' and str(
language) in ['c++', 'go']: language) in ['c++', 'go', 'java', 'javaokhttp']:
transport_security_options = [ transport_security_options = [
'--custom_credentials_type=google_default_credentials' '--custom_credentials_type=google_default_credentials'
] ]
@ -1323,7 +1323,9 @@ try:
service_account_key_file, service_account_key_file,
transport_security='tls') transport_security='tls')
jobs.append(tls_test_job) jobs.append(tls_test_job)
if str(language) in ['c++', 'go']: if str(language) in [
'c++', 'go', 'java', 'javaokhttp'
]:
google_default_creds_test_job = cloud_to_prod_jobspec( google_default_creds_test_job = cloud_to_prod_jobspec(
language, language,
test_case, test_case,

Loading…
Cancel
Save