From 2478429853a99ea6c076c6506acc28d3e0bbc385 Mon Sep 17 00:00:00 2001 From: Alan Nair Date: Tue, 20 Dec 2022 00:19:02 +0530 Subject: [PATCH] tuning-halving: Updated knative runner + workflow fixes Signed-off-by: Alan Nair --- .github/configs/wordlist.txt | 1 + .github/workflows/e2e-tuning-halving.yml | 79 ++++++++++++++----- benchmarks/tuning-halving/README.md | 8 +- .../knative_yamls/s3/service-driver.yaml | 2 +- .../knative_yamls/s3/service-trainer.yaml | 2 +- 5 files changed, 66 insertions(+), 26 deletions(-) diff --git a/.github/configs/wordlist.txt b/.github/configs/wordlist.txt index f9afe0094..f4d813341 100644 --- a/.github/configs/wordlist.txt +++ b/.github/configs/wordlist.txt @@ -98,6 +98,7 @@ coderay colocated colocating config +configmap configs CONFL congrats diff --git a/.github/workflows/e2e-tuning-halving.yml b/.github/workflows/e2e-tuning-halving.yml index 5b8146b1e..29f5063bf 100644 --- a/.github/workflows/e2e-tuning-halving.yml +++ b/.github/workflows/e2e-tuning-halving.yml @@ -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: @@ -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 @@ -102,15 +107,18 @@ 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 @@ -118,32 +126,63 @@ jobs: 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 diff --git a/benchmarks/tuning-halving/README.md b/benchmarks/tuning-halving/README.md index f2722a836..23e4b3c82 100644 --- a/benchmarks/tuning-halving/README.md +++ b/benchmarks/tuning-halving/README.md @@ -8,7 +8,7 @@ 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. @@ -16,7 +16,7 @@ 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 @@ -33,7 +33,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 @@ -59,4 +59,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. \ No newline at end of file +- `ENABLE_TRACING` - Toggles tracing. diff --git a/benchmarks/tuning-halving/knative_yamls/s3/service-driver.yaml b/benchmarks/tuning-halving/knative_yamls/s3/service-driver.yaml index 616698d5a..cfdc3f5ca 100644 --- a/benchmarks/tuning-halving/knative_yamls/s3/service-driver.yaml +++ b/benchmarks/tuning-halving/knative_yamls/s3/service-driver.yaml @@ -56,4 +56,4 @@ spec: ports: # For `h2c`, see https://knative.tips/networking/http2/ - name: h2c - containerPort: 80 \ No newline at end of file + containerPort: 80 diff --git a/benchmarks/tuning-halving/knative_yamls/s3/service-trainer.yaml b/benchmarks/tuning-halving/knative_yamls/s3/service-trainer.yaml index 226ef11de..36b5f2f62 100644 --- a/benchmarks/tuning-halving/knative_yamls/s3/service-trainer.yaml +++ b/benchmarks/tuning-halving/knative_yamls/s3/service-trainer.yaml @@ -50,4 +50,4 @@ spec: ports: # For `h2c`, see https://knative.tips/networking/http2/ - name: h2c - containerPort: 80 \ No newline at end of file + containerPort: 80