Skip to content

Commit

Permalink
tuning-halving: Updated knative runner + workflow fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Nair <[email protected]>
  • Loading branch information
alannair committed Dec 2, 2022
1 parent 1aabd77 commit 6bc2022
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/configs/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ coderay
colocated
colocating
config
configmap
configs
CONFL
congrats
Expand Down
79 changes: 59 additions & 20 deletions .github/workflows/e2e-tuning-halving.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ on:
env:
GOOS: linux
GO111MODULE: on
KUBECONFIG: /etc/kubernetes/admin.conf
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
AWS_DEFAULT_REGION: 'us-west-1'
AWS_REGION: 'us-west-1'
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}

jobs:
build-and-push:
Expand Down Expand Up @@ -83,10 +89,9 @@ jobs:
lfs: 'true'

- name: start docker-compose benchmark
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
working-directory: benchmarks/tuning-halving
env:
BUCKET_NAME: vhive-tuning
run: |
docker-compose -f docker-compose-s3.yml up &> log_file &
sleep 60s
Expand All @@ -102,48 +107,82 @@ jobs:
name: Test Knative Deployment
needs: build-and-push
env:
GOCACHE: /root/tmp/gocache
GOPATH: /root/tmp/gopath
runs-on: [stock-knative]
KIND_VERSION: v0.14.0
K8S-VERSION: v1.23

runs-on: ubuntu-20.04
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3
with:
lfs: 'true'

- name: Checkout LFS objects
run: git lfs checkout

- uses: actions/setup-go@v3
with:
go-version: 1.18

- name: Up
working-directory: benchmarks
- name: Create k8s Kind Cluster
run: bash ./runner/scripts/01-kind.sh

- name: Install Serving
run: bash ./runner/scripts/02-serving.sh

- name: Install Kourier
run: bash ./runner/scripts/02-kourier.sh

- name: Setup domain
run: |
INGRESS_HOST="127.0.0.1"
KNATIVE_DOMAIN=$INGRESS_HOST.sslip.io
kubectl patch configmap -n knative-serving config-domain -p "{\"data\": {\"$KNATIVE_DOMAIN\": \"\"}}"
- name: Setup kn
env:
KN_VERSION: v1.8.1
KN_INSTALL_PATH: /usr/local/bin/kn
run: |-
echo "Downloading kn $KN_VERSION"
sudo wget --quiet -O $KN_INSTALL_PATH "https://github.com/knative/client/releases/download/knative-$KN_VERSION/kn-linux-amd64"
sudo chmod +x $KN_INSTALL_PATH
echo "Installed kn $KN_VERSION"
- name: Deploy Functions as Knative Services
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
run: ../tools/kn_deploy.sh ./tuning-halving/knative_yamls/s3/*
BUCKET_NAME: vhive-tuning
run: tools/kn_deploy.sh benchmarks/tuning-halving/knative_yamls/s3/*

- name: Check if the Service is Ready
working-directory: benchmarks/tuning-halving/knative_yamls/s3
run: |
kubectl wait --for=condition=Ready -f service-driver.yaml --timeout 120s
kubectl get -f service-driver.yaml
kubectl wait --for=condition=Ready -f service-trainer.yaml --timeout 120s
kubectl get -f service-trainer.yaml
- name: Test
- name: Test the Function Deployment
working-directory: tools/test-client
run: |
set -x
NODEPORT=$(kubectl get svc kourier-ingress -n kourier-system -o=jsonpath='{.spec.ports[0].nodePort}')
NODEPORT=80
HOSTNAME=$(kubectl get ksvc driver -n default -o jsonpath='{.status.url}' | cut -c8-)
go build ./test-client.go
./test-client -addr $HOSTNAME:$NODEPORT
- name: Print logs
- name: Print Logs
if: ${{ always() }}
run: |
set -x
kubectl logs -n default -c user-container -l serving.knative.dev/service=driver
kubectl logs -n default -c user-container -l serving.knative.dev/service=trainer
- name: Down
- name: Delete the Deployed Services
working-directory: benchmarks/stacking-training/knative_yamls/s3
if: ${{ always() }}
run: kn service delete --all --namespace default --wait
run: |
kubectl delete -f ./service-driver.yaml --namespace default --wait
kubectl delete -f ./service-trainer.yaml --namespace default --wait
12 changes: 8 additions & 4 deletions benchmarks/tuning-halving/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,24 @@ its job is to iteratively train a number of models until the best model is found

Each iteration, the driver uses a subset of the dataset to train a number of models by issuing
requests to the training function. After training, only the top 50% of models are kept for the next
iteration, and the size of the dataset subset used for training is increased
iteration, and the size of the dataset subset used for training is increased
accordingly. This is
repeated until only one model remains.

This benchmark relies on s3 for sharing models between driver and trainer.

## Running this Benchmark

1. Make sure to set the `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` environment variables.
1. Make sure to set the `BUCKET_NAME`, `AWS_ACCESS_KEY`, and `AWS_SECRET_KEY` environment variables.
The kn_deploy script will then substitute these values into the knative manifests.
Example:
```bash
export AWS_ACCESS_KEY=ABCDEFGHIJKLMNOPQRST
export AWS_SECRET_KEY=ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN
kubectl create secret generic awscreds \
--from-literal=awsaccess=${AWS_ACCESS_KEY} \
--from-literal=awssecret=${AWS_SECRET_KEY}
kubectl create configmap envmap --from-literal=bucket=${BUCKET_NAME}
```

2. Deploy the necessary functions using the `kn_deploy` script.
Expand All @@ -33,7 +37,7 @@ This benchmark relies on s3 for sharing models between driver and trainer.
the `s3` transfer type enabled, and with tracing turned off.

3. Invoke the benchmark. The interface function of this benchmark is named `driver`. It can be
invoked using the invoker or our test client, as described in the
invoked using the invoker or our test client, as described in the
[running benchmarks](/docs/running_benchmarks.md) document.

## Instances
Expand All @@ -59,4 +63,4 @@ all benchmarks support all transfer types.
transfer type is used
- `BUCKET_NAME` - Set custom s3 bucket name, only needed if the s3 transfer type is used,
default bucket name is set as 'vhive-tuning'
- `ENABLE_TRACING` - Toggles tracing.
- `ENABLE_TRACING` - Toggles tracing.
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ spec:
ports:
# For `h2c`, see https://knative.tips/networking/http2/
- name: h2c
containerPort: 80
containerPort: 80
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ spec:
ports:
# For `h2c`, see https://knative.tips/networking/http2/
- name: h2c
containerPort: 80
containerPort: 80

0 comments on commit 6bc2022

Please sign in to comment.