Skip to content
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
181 changes: 90 additions & 91 deletions benchmarking/locust/common/ateapi_pb2.py

Large diffs are not rendered by default.

107 changes: 71 additions & 36 deletions benchmarking/locust/common/ateapi_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ def __init__(self, channel):
self.GetActor = channel.unary_unary(
'/ateapi.Control/GetActor',
request_serializer=ateapi__pb2.GetActorRequest.SerializeToString,
response_deserializer=ateapi__pb2.GetActorResponse.FromString,
response_deserializer=ateapi__pb2.Actor.FromString,
_registered_method=True)
self.CreateActor = channel.unary_unary(
'/ateapi.Control/CreateActor',
request_serializer=ateapi__pb2.CreateActorRequest.SerializeToString,
response_deserializer=ateapi__pb2.CreateActorResponse.FromString,
response_deserializer=ateapi__pb2.Actor.FromString,
_registered_method=True)
self.UpdateActor = channel.unary_unary(
'/ateapi.Control/UpdateActor',
Expand All @@ -82,7 +82,7 @@ def __init__(self, channel):
self.DeleteActor = channel.unary_unary(
'/ateapi.Control/DeleteActor',
request_serializer=ateapi__pb2.DeleteActorRequest.SerializeToString,
response_deserializer=ateapi__pb2.DeleteActorResponse.FromString,
response_deserializer=ateapi__pb2.Actor.FromString,
_registered_method=True)
self.ListWorkers = channel.unary_unary(
'/ateapi.Control/ListWorkers',
Expand All @@ -97,12 +97,12 @@ def __init__(self, channel):
self.CreateAtespace = channel.unary_unary(
'/ateapi.Control/CreateAtespace',
request_serializer=ateapi__pb2.CreateAtespaceRequest.SerializeToString,
response_deserializer=ateapi__pb2.CreateAtespaceResponse.FromString,
response_deserializer=ateapi__pb2.Atespace.FromString,
_registered_method=True)
self.GetAtespace = channel.unary_unary(
'/ateapi.Control/GetAtespace',
request_serializer=ateapi__pb2.GetAtespaceRequest.SerializeToString,
response_deserializer=ateapi__pb2.GetAtespaceResponse.FromString,
response_deserializer=ateapi__pb2.Atespace.FromString,
_registered_method=True)
self.ListAtespaces = channel.unary_unary(
'/ateapi.Control/ListAtespaces',
Expand All @@ -112,12 +112,7 @@ def __init__(self, channel):
self.DeleteAtespace = channel.unary_unary(
'/ateapi.Control/DeleteAtespace',
request_serializer=ateapi__pb2.DeleteAtespaceRequest.SerializeToString,
response_deserializer=ateapi__pb2.DeleteAtespaceResponse.FromString,
_registered_method=True)
self.DebugClear = channel.unary_unary(
'/ateapi.Control/DebugClear',
request_serializer=ateapi__pb2.DebugClearRequest.SerializeToString,
response_deserializer=ateapi__pb2.DebugClearResponse.FromString,
response_deserializer=ateapi__pb2.Atespace.FromString,
_registered_method=True)


Expand Down Expand Up @@ -216,25 +211,18 @@ def DeleteAtespace(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DebugClear(self, request, context):
"""Debugging: drop all data from the ate database.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_ControlServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetActor': grpc.unary_unary_rpc_method_handler(
servicer.GetActor,
request_deserializer=ateapi__pb2.GetActorRequest.FromString,
response_serializer=ateapi__pb2.GetActorResponse.SerializeToString,
response_serializer=ateapi__pb2.Actor.SerializeToString,
),
'CreateActor': grpc.unary_unary_rpc_method_handler(
servicer.CreateActor,
request_deserializer=ateapi__pb2.CreateActorRequest.FromString,
response_serializer=ateapi__pb2.CreateActorResponse.SerializeToString,
response_serializer=ateapi__pb2.Actor.SerializeToString,
),
'UpdateActor': grpc.unary_unary_rpc_method_handler(
servicer.UpdateActor,
Expand All @@ -259,7 +247,7 @@ def add_ControlServicer_to_server(servicer, server):
'DeleteActor': grpc.unary_unary_rpc_method_handler(
servicer.DeleteActor,
request_deserializer=ateapi__pb2.DeleteActorRequest.FromString,
response_serializer=ateapi__pb2.DeleteActorResponse.SerializeToString,
response_serializer=ateapi__pb2.Actor.SerializeToString,
),
'ListWorkers': grpc.unary_unary_rpc_method_handler(
servicer.ListWorkers,
Expand All @@ -274,12 +262,12 @@ def add_ControlServicer_to_server(servicer, server):
'CreateAtespace': grpc.unary_unary_rpc_method_handler(
servicer.CreateAtespace,
request_deserializer=ateapi__pb2.CreateAtespaceRequest.FromString,
response_serializer=ateapi__pb2.CreateAtespaceResponse.SerializeToString,
response_serializer=ateapi__pb2.Atespace.SerializeToString,
),
'GetAtespace': grpc.unary_unary_rpc_method_handler(
servicer.GetAtespace,
request_deserializer=ateapi__pb2.GetAtespaceRequest.FromString,
response_serializer=ateapi__pb2.GetAtespaceResponse.SerializeToString,
response_serializer=ateapi__pb2.Atespace.SerializeToString,
),
'ListAtespaces': grpc.unary_unary_rpc_method_handler(
servicer.ListAtespaces,
Expand All @@ -289,12 +277,7 @@ def add_ControlServicer_to_server(servicer, server):
'DeleteAtespace': grpc.unary_unary_rpc_method_handler(
servicer.DeleteAtespace,
request_deserializer=ateapi__pb2.DeleteAtespaceRequest.FromString,
response_serializer=ateapi__pb2.DeleteAtespaceResponse.SerializeToString,
),
'DebugClear': grpc.unary_unary_rpc_method_handler(
servicer.DebugClear,
request_deserializer=ateapi__pb2.DebugClearRequest.FromString,
response_serializer=ateapi__pb2.DebugClearResponse.SerializeToString,
response_serializer=ateapi__pb2.Atespace.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
Expand Down Expand Up @@ -324,7 +307,7 @@ def GetActor(request,
target,
'/ateapi.Control/GetActor',
ateapi__pb2.GetActorRequest.SerializeToString,
ateapi__pb2.GetActorResponse.FromString,
ateapi__pb2.Actor.FromString,
options,
channel_credentials,
insecure,
Expand All @@ -351,7 +334,7 @@ def CreateActor(request,
target,
'/ateapi.Control/CreateActor',
ateapi__pb2.CreateActorRequest.SerializeToString,
ateapi__pb2.CreateActorResponse.FromString,
ateapi__pb2.Actor.FromString,
options,
channel_credentials,
insecure,
Expand Down Expand Up @@ -486,7 +469,7 @@ def DeleteActor(request,
target,
'/ateapi.Control/DeleteActor',
ateapi__pb2.DeleteActorRequest.SerializeToString,
ateapi__pb2.DeleteActorResponse.FromString,
ateapi__pb2.Actor.FromString,
options,
channel_credentials,
insecure,
Expand Down Expand Up @@ -567,7 +550,7 @@ def CreateAtespace(request,
target,
'/ateapi.Control/CreateAtespace',
ateapi__pb2.CreateAtespaceRequest.SerializeToString,
ateapi__pb2.CreateAtespaceResponse.FromString,
ateapi__pb2.Atespace.FromString,
options,
channel_credentials,
insecure,
Expand All @@ -594,7 +577,7 @@ def GetAtespace(request,
target,
'/ateapi.Control/GetAtespace',
ateapi__pb2.GetAtespaceRequest.SerializeToString,
ateapi__pb2.GetAtespaceResponse.FromString,
ateapi__pb2.Atespace.FromString,
options,
channel_credentials,
insecure,
Expand Down Expand Up @@ -648,7 +631,7 @@ def DeleteAtespace(request,
target,
'/ateapi.Control/DeleteAtespace',
ateapi__pb2.DeleteAtespaceRequest.SerializeToString,
ateapi__pb2.DeleteAtespaceResponse.FromString,
ateapi__pb2.Atespace.FromString,
options,
channel_credentials,
insecure,
Expand All @@ -659,6 +642,58 @@ def DeleteAtespace(request,
metadata,
_registered_method=True)


class DebugStub:
"""Debug is the RPC interface for administrative and debugging operations
(such as wiping state during development).
"""

def __init__(self, channel):
"""Constructor.

Args:
channel: A grpc.Channel.
"""
self.DebugClear = channel.unary_unary(
'/ateapi.Debug/DebugClear',
request_serializer=ateapi__pb2.DebugClearRequest.SerializeToString,
response_deserializer=ateapi__pb2.DebugClearResponse.FromString,
_registered_method=True)


class DebugServicer:
"""Debug is the RPC interface for administrative and debugging operations
(such as wiping state during development).
"""

def DebugClear(self, request, context):
"""Debugging: drop all data from the ate database.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_DebugServicer_to_server(servicer, server):
rpc_method_handlers = {
'DebugClear': grpc.unary_unary_rpc_method_handler(
servicer.DebugClear,
request_deserializer=ateapi__pb2.DebugClearRequest.FromString,
response_serializer=ateapi__pb2.DebugClearResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ateapi.Debug', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
server.add_registered_method_handlers('ateapi.Debug', rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
class Debug:
"""Debug is the RPC interface for administrative and debugging operations
(such as wiping state during development).
"""

@staticmethod
def DebugClear(request,
target,
Expand All @@ -673,7 +708,7 @@ def DebugClear(request,
return grpc.experimental.unary_unary(
request,
target,
'/ateapi.Control/DebugClear',
'/ateapi.Debug/DebugClear',
ateapi__pb2.DebugClearRequest.SerializeToString,
ateapi__pb2.DebugClearResponse.FromString,
options,
Expand Down
8 changes: 6 additions & 2 deletions benchmarking/locust/common/atespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from common.grpc_tracing import traced_grpc

# Single atespace for all benchmark runs. Actor names within an atespace
# must be unique, and every user picks an `sb-<uuid>` actor id, so a
# must be unique, and every user picks an `sb-<uuid>` actor name, so a
# shared atespace doesn't introduce collisions.
ATESPACE = "benchmark"

Expand All @@ -35,7 +35,11 @@ def ensure_atespace(stub, user_class: str, name: str = ATESPACE) -> None:
with traced_grpc("CreateAtespace", user_class) as metadata:
try:
_, metadata.call = stub.CreateAtespace.with_call(
ateapi_pb2.CreateAtespaceRequest(name=name),
ateapi_pb2.CreateAtespaceRequest(
atespace=ateapi_pb2.Atespace(
metadata=ateapi_pb2.ResourceMetadata(name=name)
)
),
metadata=metadata,
)
except grpc.RpcError as e:
Expand Down
22 changes: 13 additions & 9 deletions benchmarking/locust/tests/ate_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@ def on_start(self) -> None:
print(f"Failed to ensure atespace {ATESPACE}: {e}")

# Call CreateActor
self.actor_id = str(uuid.uuid4())
self.actor_ref = ateapi_pb2.ActorRef(atespace=ATESPACE, name=self.actor_id)
self.actor_name = str(uuid.uuid4())
self.actor_ref = ateapi_pb2.ObjectRef(atespace=ATESPACE, name=self.actor_name)
try:
self.stub.CreateActor(
ateapi_pb2.CreateActorRequest(
actor_ref=self.actor_ref,
actor_template_namespace="ate-demo-counter",
actor_template_name="counter"
actor=ateapi_pb2.Actor(
metadata=ateapi_pb2.ResourceMetadata(
atespace=ATESPACE, name=self.actor_name
),
actor_template_namespace="ate-demo-counter",
actor_template_name="counter",
)
)
)
except Exception as e:
Expand All @@ -78,7 +82,7 @@ def on_stop(self) -> None:
update_user_count(-1, self.__class__.__name__)
try:
self.stub.SuspendActor(
ateapi_pb2.SuspendActorRequest(actor_ref=self.actor_ref)
ateapi_pb2.SuspendActorRequest(actor=self.actor_ref)
)
except Exception as e:
print(f"Failed to suspend actor: {e}")
Expand All @@ -89,7 +93,7 @@ def invoke_target(self) -> None:
try:
with traced_grpc("GetActor", self.__class__.__name__) as metadata:
_, metadata.call = self.stub.GetActor.with_call(
ateapi_pb2.GetActorRequest(actor_ref=self.actor_ref),
ateapi_pb2.GetActorRequest(actor=self.actor_ref),
metadata=metadata,
)
except Exception:
Expand All @@ -98,7 +102,7 @@ def invoke_target(self) -> None:
try:
with traced_grpc("ResumeActor", self.__class__.__name__) as metadata:
_, metadata.call = self.stub.ResumeActor.with_call(
ateapi_pb2.ResumeActorRequest(actor_ref=self.actor_ref),
ateapi_pb2.ResumeActorRequest(actor=self.actor_ref),
metadata=metadata,
)
except Exception:
Expand All @@ -107,7 +111,7 @@ def invoke_target(self) -> None:
try:
with traced_grpc("SuspendActor", self.__class__.__name__) as metadata:
_, metadata.call = self.stub.SuspendActor.with_call(
ateapi_pb2.SuspendActorRequest(actor_ref=self.actor_ref),
ateapi_pb2.SuspendActorRequest(actor=self.actor_ref),
metadata=metadata,
)
except Exception:
Expand Down
Loading
Loading