Skip to content

Commit c911941

Browse files
Lakshmandhschall
authored andcommitted
Added proto files for rnn-serving and video-analytics-standalone.
Updated protos for all benchmarks. Signed-off-by: L Lakshmanan <[email protected]>
1 parent a9f922b commit c911941

23 files changed

+1318
-477
lines changed

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ replace (
1414
github.com/vhive-serverless/vSwarm-proto/proto/hotel_reserv => ./proto/hotel_reserv
1515
github.com/vhive-serverless/vSwarm-proto/proto/image_rotate => ./proto/image_rotate
1616
github.com/vhive-serverless/vSwarm-proto/proto/video_processing => ./proto/video_processing
17+
github.com/vhive-serverless/vSwarm-proto/proto/rnn_serving => ./proto/rnn_serving
18+
github.com/vhive-serverless/vSwarm-proto/proto/video_analytics_standalone => ./proto/video_analytics_standalone
1719
)
1820

1921
require (

grpcclient/getclient.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ func FindServiceName(functionName string) string {
2020
return "image-rotate"
2121
case "video-processing-python":
2222
return "video-processing"
23+
case "rnn-serving-python":
24+
return "rnn-serving"
25+
case "video-analytics-standalone-python":
26+
return "video-analytics-standalone"
2327
case "spright-parking-python":
2428
return "spright-parking"
2529
default:
@@ -55,6 +59,12 @@ func FindGrpcClient(service_name string) GrpcClient {
5559
case "video-processing":
5660
log.Debug("Found video processing client")
5761
return new(VideoProcessingClient)
62+
case "rnn-serving":
63+
log.Debug("Found rnn serving client")
64+
return new(RNNServingClient)
65+
case "video-analytics-standalone":
66+
log.Debug("Found video analytics standalone client")
67+
return new(VideoAnalyticsClient)
5868

5969
// Hotel reservation ---
6070
case "Geo", "geo":

grpcclient/rnn_serving_client.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package grpcclient
2+
3+
import (
4+
"context"
5+
"math/rand"
6+
"strconv"
7+
"strings"
8+
9+
pb "github.com/vhive-serverless/vSwarm-proto/proto/rnn_serving"
10+
)
11+
12+
type RNNServingGenerator struct {
13+
GeneratorBase
14+
}
15+
16+
func (g *RNNServingGenerator) Next() Input {
17+
18+
countries := []string{
19+
"French", "Czech", "Dutch", "Polish", "Scottish", "Chinese",
20+
"English", "Italian", "Portuguese", "Japanese", "German",
21+
"Russian", "Korean", "Arabic", "Greek", "Vietnamese", "Spanish", "Irish",
22+
}
23+
24+
var pkt = g.defaultInput
25+
26+
switch g.GeneratorBase.generator {
27+
case Unique:
28+
country := "English"
29+
numSamples := 1
30+
pkt.Value = country + " " + strconv.Itoa(numSamples)
31+
32+
case Random:
33+
randomCountry := countries[rand.Intn(len(countries))]
34+
var numSamples int
35+
if g.lowerBound == g.upperBound {
36+
numSamples = g.lowerBound
37+
} else {
38+
numSamples = g.lowerBound + rand.Intn(g.upperBound-g.lowerBound)
39+
}
40+
pkt.Value = randomCountry + " " + strconv.Itoa(numSamples)
41+
}
42+
return pkt
43+
}
44+
45+
func (c *RNNServingClient) GetGenerator() Generator {
46+
return new(RNNServingGenerator)
47+
}
48+
49+
type RNNServingClient struct {
50+
ClientBase
51+
client pb.RNNServingClient
52+
}
53+
54+
func (c *RNNServingClient) Init(ctx context.Context, ip, port string) error {
55+
err := c.Connect(ctx, ip, port)
56+
if err != nil {
57+
return err
58+
}
59+
c.client = pb.NewRNNServingClient(c.conn)
60+
return nil
61+
}
62+
63+
func (c *RNNServingClient) Request(ctx context.Context, req Input) (string, error) {
64+
65+
inputs = strings.Split(req.Value, " ")
66+
language := inputs[0]
67+
numSamples, _ := strconv.ParseInt(inputs[1], 10, 32)
68+
69+
r, err := c.client.GenerateString(ctx, &pb.SendLanguage{Language: string(language), NumSamples: int32(numSamples)})
70+
if err != nil {
71+
return "", err
72+
}
73+
return r.GetMessage(), nil
74+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package grpcclient
2+
3+
import (
4+
"context"
5+
6+
pb "github.com/vhive-serverless/vSwarm-proto/proto/video_analytics_standalone"
7+
)
8+
9+
type VideoAnalyticsGenerator struct {
10+
GeneratorBase
11+
}
12+
13+
func (g *VideoAnalyticsGenerator) Next() Input {
14+
var pkt = g.defaultInput
15+
return pkt
16+
}
17+
18+
func (c *VideoAnalyticsClient) GetGenerator() Generator {
19+
return new(VideoAnalyticsGenerator)
20+
}
21+
22+
type VideoAnalyticsClient struct {
23+
ClientBase
24+
client pb.VideoAnalyticsClient
25+
}
26+
27+
func (c *VideoAnalyticsClient) Init(ctx context.Context, ip, port string) error {
28+
err := c.Connect(ctx, ip, port)
29+
if err != nil {
30+
return err
31+
}
32+
c.client = pb.NewVideoAnalyticsClient(c.conn)
33+
return nil
34+
}
35+
36+
func (c *VideoAnalyticsClient) Request(ctx context.Context, req Input) (string, error) {
37+
r, err := c.client.ObjectDetection(ctx, &pb.SendVideo{Name: req.Value})
38+
if err != nil {
39+
return "", err
40+
}
41+
return r.GetMessage(), nil
42+
}

proto/aes/aes_pb2.py

Lines changed: 10 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/auth/auth_pb2.py

Lines changed: 10 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/fibonacci/fibonacci_pb2.py

Lines changed: 10 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/gptj/gptj_pb2.py

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/gptj/gptj_pb2_grpc.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""Client and server classes corresponding to protobuf-defined services."""
33
import grpc
44

5-
import gptj_pb2 as gptj__pb2
5+
from proto.gptj import gptj_pb2 as proto_dot_gptj_dot_gptj__pb2
66

77

88
class GptJBenchmarkStub(object):
@@ -16,8 +16,8 @@ def __init__(self, channel):
1616
"""
1717
self.GetBenchmark = channel.unary_unary(
1818
'/gptj.GptJBenchmark/GetBenchmark',
19-
request_serializer=gptj__pb2.GptJBenchmarkRequest.SerializeToString,
20-
response_deserializer=gptj__pb2.GptJBenchmarkReply.FromString,
19+
request_serializer=proto_dot_gptj_dot_gptj__pb2.GptJBenchmarkRequest.SerializeToString,
20+
response_deserializer=proto_dot_gptj_dot_gptj__pb2.GptJBenchmarkReply.FromString,
2121
)
2222

2323

@@ -35,8 +35,8 @@ def add_GptJBenchmarkServicer_to_server(servicer, server):
3535
rpc_method_handlers = {
3636
'GetBenchmark': grpc.unary_unary_rpc_method_handler(
3737
servicer.GetBenchmark,
38-
request_deserializer=gptj__pb2.GptJBenchmarkRequest.FromString,
39-
response_serializer=gptj__pb2.GptJBenchmarkReply.SerializeToString,
38+
request_deserializer=proto_dot_gptj_dot_gptj__pb2.GptJBenchmarkRequest.FromString,
39+
response_serializer=proto_dot_gptj_dot_gptj__pb2.GptJBenchmarkReply.SerializeToString,
4040
),
4141
}
4242
generic_handler = grpc.method_handlers_generic_handler(
@@ -60,7 +60,7 @@ def GetBenchmark(request,
6060
timeout=None,
6161
metadata=None):
6262
return grpc.experimental.unary_unary(request, target, '/gptj.GptJBenchmark/GetBenchmark',
63-
gptj__pb2.GptJBenchmarkRequest.SerializeToString,
64-
gptj__pb2.GptJBenchmarkReply.FromString,
63+
proto_dot_gptj_dot_gptj__pb2.GptJBenchmarkRequest.SerializeToString,
64+
proto_dot_gptj_dot_gptj__pb2.GptJBenchmarkReply.FromString,
6565
options, channel_credentials,
6666
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

0 commit comments

Comments
 (0)