Skip to content

Commit

Permalink
gRPC bugfix for Dirigent
Browse files Browse the repository at this point in the history
Signed-off-by: Lazar Cvetković <[email protected]>
  • Loading branch information
cvetkovic committed Oct 29, 2024
1 parent d8be132 commit 3e27862
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
5 changes: 0 additions & 5 deletions data/traces/example/dirigent.csv

This file was deleted.

2 changes: 2 additions & 0 deletions pkg/common/trace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ type DirigentMetadata struct {
ScalingLowerBound int `csv:"ScalingLowerBound"`
IterationMultiplier int `csv:"IterationMultiplier"`
IOPercentage int `csv:"IOPercentage"`
EnvVars string `csv:"EnvVars"`
ProgramArgs string `csv:"ProgramArgs"`
}

type Function struct {
Expand Down
3 changes: 3 additions & 0 deletions pkg/driver/clients/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func (i *grpcInvoker) Invoke(function *common.Function, runtimeSpec *common.Runt

var dialOptions []grpc.DialOption
dialOptions = append(dialOptions, grpc.WithTransportCredentials(insecure.NewCredentials()))
if strings.Contains(strings.ToLower(i.cfg.Platform), "dirigent") {
dialOptions = append(dialOptions, grpc.WithAuthority(function.Name)) // Dirigent specific
}
if i.cfg.EnableZipkinTracing {
dialOptions = append(dialOptions, grpc.WithStatsHandler(otelgrpc.NewClientHandler()))
}
Expand Down
14 changes: 14 additions & 0 deletions pkg/driver/deployment/dirigent.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ var registrationClient = &http.Client{
},
}

const CSVColumnDelimiter = " "

func prepareEnvVars(data string) []string {
// FORMAT: arg1=value1 arg2=value2
return strings.Split(data, CSVColumnDelimiter)
}

func prepareProgramArgs(data string) []string {
// FORMAT: arg1 val1 arg2 val2
return strings.Split(data, CSVColumnDelimiter)
}

func deployDirigent(function *common.Function, controlPlaneAddress string, busyLoopOnColdStart bool) {
metadata := function.DirigentMetadata

Expand All @@ -68,6 +80,8 @@ func deployDirigent(function *common.Function, controlPlaneAddress string, busyL
"scaling_lower_bound": {strconv.Itoa(metadata.ScalingLowerBound)},
"requested_cpu": {strconv.Itoa(function.CPURequestsMilli)},
"requested_memory": {strconv.Itoa(function.MemoryRequestsMiB)},
"env_vars": prepareEnvVars(metadata.EnvVars),
"program_args": prepareProgramArgs(metadata.ProgramArgs),
}

if busyLoopOnColdStart {
Expand Down

0 comments on commit 3e27862

Please sign in to comment.