Skip to content

Commit d3ff082

Browse files
committed
Changed pre-deployment to Go command from bash script
Signed-off-by: aryans1204 <arshar1204@gmail.com>
1 parent b8d098b commit d3ff082

File tree

10 files changed

+34
-23
lines changed

10 files changed

+34
-23
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pkg/workload/openwhisk/*.zip
1515
tools/*/__pycache__
1616
tools/trace_synthesizer/*.csv
1717
tools/trace_synthesizer/*/*.csv
18+
workloads/container/yamls/
1819

1920
### CMake ###
2021
CMakeLists.txt.user
@@ -209,4 +210,4 @@ tools/plotter/test-out
209210
*.swp
210211

211212
data/traces/azure_*
212-
data/traces/day*
213+
data/traces/day*

docs/generate_deploy_info_docs.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Deploy Info JSON
22

3-
## The `deploy_info.json` file in the `yamls.tar.gz` is used to identify the relative file paths for the Knative YAML manifests for deploying vSwarm functions. It is generated using `generate_deploy_info.py` Python script, also present under `yamls.tar.gz`, which outputs a JSON that embeds the yaml-location and pre-deployment commands for every vSwarm function. zit also contains the path of YAML files needed as part of the pre-deployment commands to run certain vSwarm benchmarks, for example the `online-shop-database` which requires to be deployed before running `cartservice` benchmark.
3+
## The `deploy_info.json` file in the `vSwarm_deploy_metadata.tar.gz` is used to identify the relative file paths for the Knative YAML manifests for deploying vSwarm functions. It is generated using `workloads/container/generate_deploy_info.py` Python script, which outputs a JSON that embeds the yaml-location and pre-deployment commands for every vSwarm function. It also contains the path of YAML files needed as part of the pre-deployment commands to run certain vSwarm benchmarks, for example the `online-shop-database` which requires to be deployed before running `cartservice` benchmark.
44

5-
## While the `deploy_info.json` file ships with the `yamls.tar.gz`, In order to regenerate the `deploy_info.json` run:
5+
While the `deploy_info.json` file ships with the `vSwarm_deploy_metadata.tar.gz`, In order to regenerate the `deploy_info.json` run from the root of this repository:
66
```console
77
tar -xzvf workloads/container/vSwarm_deploy_metadata.tar.gz -C workloads/container
8-
cd workloads/container/yamls/
8+
cd workloads/container/
99
python3 generate_deploy_info.py
1010
```
1111

@@ -15,7 +15,18 @@ The `deploy_info.json` has the following schema:
1515
vswarm-function-name:
1616
{
1717
YamlLocation: /path/to/yaml
18-
PredeploymentPath: [/path/to/predeployment/yaml]
18+
PredeploymentPath: [/path/to/predeployment-database/yaml]
1919
}
2020
}
21+
```
22+
23+
## The `PredeploymentPath` is the path to the YAML file, which is applied via `kubectl apply -f`, before creating the service under `YamlLocation`. This pre-deployment step is required in some vSwarm benchmarks, like `cartservice` which depends on a separate service `online-shop-database` before it can be started.
24+
25+
Similarly, the `workloads/container/generate_all_yamls.py` is a wrapper script that calls the `generate-yamls.py` script for each vSwarm benchmark in the `vSwarm_deploy_metadata.tar.gz`. The `generate-yamls.py` Python script parametrizes the YAML script for the benchmark for different configurations, and creates YAML files accordingly.
26+
27+
While the YAMLs are pre-generated inside the `vSwarm_deploy_metadata.tar.gz` tarball, to regenerate the YAMLs, run this from the root of this repository:
28+
```console
29+
tar -xzvf workloads/container/vSwarm_deploy_metadata.tar.gz -C workloads/container
30+
cd workloads/container
31+
python3 generate_all_yamls.py
2132
```

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ require (
3333
github.com/campoy/embedmd v1.0.0 // indirect
3434
github.com/davecgh/go-spew v1.1.1 // indirect
3535
github.com/davidmz/go-pageant v1.0.2 // indirect
36+
github.com/go-cmd/cmd v1.4.3 // indirect
3637
github.com/go-fonts/liberation v0.3.3 // indirect
3738
github.com/go-latex/latex v0.0.0-20240709081214-31cef3c7570e // indirect
3839
github.com/go-logr/logr v1.4.2 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
1818
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1919
github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
2020
github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE=
21+
github.com/go-cmd/cmd v1.4.3 h1:6y3G+3UqPerXvPcXvj+5QNPHT02BUw7p6PsqRxLNA7Y=
22+
github.com/go-cmd/cmd v1.4.3/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk=
2123
github.com/go-fonts/dejavu v0.3.4 h1:Qqyx9IOs5CQFxyWTdvddeWzrX0VNwUAvbmAzL0fpjbc=
2224
github.com/go-fonts/dejavu v0.3.4/go.mod h1:D1z0DglIz+lmpeNYMYlxW4r22IhcdOYnt+R3PShU/Kg=
2325
github.com/go-fonts/latin-modern v0.3.3 h1:g2xNgI8yzdNzIVm+qvbMryB6yGPe0pSMss8QT3QwlJ0=

pkg/driver/deployment/knative.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"strconv"
1111
"sync"
1212

13+
"github.com/go-cmd/cmd"
1314
log "github.com/sirupsen/logrus"
1415
"github.com/vhive-serverless/loader/pkg/common"
1516
"github.com/vhive-serverless/loader/pkg/config"
@@ -106,13 +107,12 @@ func knativeDeploySingleFunction(function *common.Function, yamlPath string, isP
106107
// second, then round to an integer as that is what the knative config expects
107108
}
108109
for _, path := range function.PredeploymentPath {
109-
out := exec.Command(
110-
"bash",
111-
"./pkg/driver/deployment/predeploy_vswarm.sh",
112-
path,
113-
)
114-
response, _ := out.CombinedOutput()
115-
log.Debug("Predeployment command response is", string(response))
110+
envCmd := cmd.NewCmd("kubectl", "apply", "-f", path)
111+
status := <-envCmd.Start()
112+
113+
for _, line := range status.Stdout {
114+
fmt.Println("Predeployment command response is" + line)
115+
}
116116
}
117117
cmd := exec.Command(
118118
"bash",

pkg/driver/deployment/predeploy_vswarm.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

workloads/container/.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

workloads/container/generate_all_yamls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
# Run the python script
1616
subprocess.run(['python3', 'generate-yamls.py'])
1717
print(f"Generated yaml files for {directory}")
18-
os.chdir(current_dir)
18+
os.chdir(yaml_dir)
1919

2020
print("Generated all yaml files")

workloads/container/generate_deploy_info.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212

1313
# Get the current working directory
1414
current_dir = os.getcwd()+"/yamls"
15-
15+
print(current_dir)
1616
# Get the list of directories
17-
directories = [d for d in os.listdir(current_dir) if os.path.isdir(d)]
18-
17+
directories = [d for d in os.listdir(current_dir) if d != "deploy_info.json"]
18+
print(directories)
1919
predeployment_required = ["hotel-app", "image-rotate-python", "image-rotate-go", "video-processing", "video-analytics-standalone", "online-shop"]
2020

2121
deploy_info = {}
2222
for directory in directories:
23-
os.chdir(directory)
23+
os.chdir(os.path.join(current_dir, directory))
2424
# Get the list of yaml files
2525
yaml_files = glob.glob("*.yaml")
2626
function_name = {}
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:3660ccf88e8718998efdea6616ed6cd588a2da0f412441e0d4e66ed87a4a3da5
3-
size 24157
2+
oid sha256:eafd72174b1e5d5632bf4b0de8652b16823207ffb4cabdc31ce97d210889cf99
3+
size 22901

0 commit comments

Comments
 (0)