Skip to content

Commit 4adbd4e

Browse files
committed
Added deployment of predeployment commands for vSwarm benchmarks
Signed-off-by: aryans1204 <arshar1204@gmail.com>
1 parent 2ab6209 commit 4adbd4e

File tree

6 files changed

+29
-20
lines changed

6 files changed

+29
-20
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"c13acdc7567b225971cef2416a3a2b03c8a4d8d154df48afe75834e2f5c59ddf": {
3-
"proxy-function": "video-processing-python-10"
3+
"proxy-function": "cartservice"
44
},
55
"a2faad786b3c813b12ce57d349d5e62f6d0f22ceecfa86cd72a962853383b600": {
66
"proxy-function": "image-rotate-go-11"
77
},
88
"7dc5aeabc131669912e8c793c8925cc9928321f45f13a4af031592b4611630d7": {
9-
"proxy-function": "video-processing-python-100"
9+
"proxy-function": "video-processing-python-10"
1010
},
1111
"ae8a1640fa932024f59b38a0b001808b5c64612bd60c6f3eb80ba9461ba2d091": {
12-
"proxy-function": "video-processing-python-10"
12+
"proxy-function": "video-processing-python-100"
1313
}
1414
}

pkg/common/trace_types.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ type Function struct {
9999

100100
ColdStartBusyLoopMs int
101101

102-
CPURequestsMilli int
103-
MemoryRequestsMiB int
104-
CPULimitsMilli int
105-
YAMLPath string
106-
Specification *FunctionSpecification
102+
CPURequestsMilli int
103+
MemoryRequestsMiB int
104+
CPULimitsMilli int
105+
YAMLPath string
106+
PredeploymentCommands []string
107+
Specification *FunctionSpecification
107108
}
108109

109110
type Node struct {

pkg/driver/deployment/knative.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ package deployment
33
import (
44
"bytes"
55
"fmt"
6-
log "github.com/sirupsen/logrus"
7-
"github.com/vhive-serverless/loader/pkg/common"
8-
"github.com/vhive-serverless/loader/pkg/config"
96
"math"
107
"os/exec"
118
"regexp"
129
"runtime"
1310
"strconv"
1411
"sync"
12+
13+
log "github.com/sirupsen/logrus"
14+
"github.com/vhive-serverless/loader/pkg/common"
15+
"github.com/vhive-serverless/loader/pkg/config"
1516
)
1617

1718
const (
@@ -94,7 +95,11 @@ func knativeDeploySingleFunction(function *common.Function, yamlPath string, isP
9495
// for rps mode use the average runtime in milliseconds to determine how many requests a pod can process per
9596
// second, then round to an integer as that is what the knative config expects
9697
}
97-
98+
for _, command := range function.PredeploymentCommands {
99+
_ = exec.Command(
100+
command,
101+
)
102+
}
98103
cmd := exec.Command(
99104
"bash",
100105
"./pkg/driver/deployment/knative.sh",

pkg/trace/mapper_trace_parser.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ func (p *MapperTraceParser) extractFunctions(mapperOutput map[string]map[string]
4848
hashFunction := invocationStats.HashFunction
4949
proxyFunction := mapperOutput[hashFunction]["proxy-function"]
5050
yamlPath := deploymentInfo[proxyFunction].YamlLocation
51-
51+
predeploymentCommands := deploymentInfo[proxyFunction].PredeploymentCommands
5252
function := &common.Function{
5353
Name: fmt.Sprintf("%s-%d-%d", proxyFunction, i, p.functionNameGenerator.Uint64()),
5454

55-
InvocationStats: &invocationStats,
56-
RuntimeStats: runtimeByHashFunction[hashFunction],
57-
MemoryStats: memoryByHashFunction[hashFunction],
58-
YAMLPath: yamlPath,
55+
InvocationStats: &invocationStats,
56+
RuntimeStats: runtimeByHashFunction[hashFunction],
57+
MemoryStats: memoryByHashFunction[hashFunction],
58+
YAMLPath: yamlPath,
59+
PredeploymentCommands: predeploymentCommands,
5960
}
6061

6162
result = append(result, function)

pkg/trace/mapper_trace_parser_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ func TestMapperParserWrapper(t *testing.T) {
1414
}
1515
if !strings.HasPrefix(functions[0].Name, "cartservice") ||
1616
functions[0].InvocationStats == nil ||
17-
functions[0].YAMLPath != "workloads/container/yamls/online-shop/kn-cartservice.yaml" {
17+
functions[0].YAMLPath != "workloads/container/yamls/online-shop/kn-cartservice.yaml" ||
18+
len(functions[0].PredeploymentCommands) != 1 ||
19+
functions[0].PredeploymentCommands[0] != "kubectl apply -f workloads/container/yamls/online-shop/database.yaml" {
1820
t.Error("Unexpected results.")
1921
}
2022
}

workloads/container/yamls.tar.gz

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:f9668c376425a77a640153d8a0b164fc123b90c22d65cc5b382e4c3f529ec125
3-
size 24156
2+
oid sha256:abf8c5e3bc3ba592fb429a4ecbe89a53c235fa51015455d4669568fc9eecbe97
3+
size 24189

0 commit comments

Comments
 (0)