This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
try: kill server from client #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: benchmark-group-1 | |
on: | |
push: | |
branches: | |
- lkl/benchmark | |
pull_request: | |
branches: | |
- lkl/benchmark | |
workflow_dispatch: | |
jobs: | |
start-runner: | |
name: Start self-hosted EC2 runner | |
runs-on: ubuntu-latest | |
outputs: | |
server-label: ${{ steps.start-server-ec2-runner.outputs.label }} | |
server-ec2-instance-id: ${{ steps.start-server-ec2-runner.outputs.ec2-instance-id }} | |
private-ip: ${{ steps.get-private-ip.outputs.private-ip }} | |
benchmark-label: ${{ steps.start-benchmark-ec2-runner.outputs.label }} | |
benchmark-ec2-instance-id: ${{ steps.start-benchmark-ec2-runner.outputs.ec2-instance-id }} | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.GROUP_1_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.GROUP_1_AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Start Server EC2 runner | |
id: start-server-ec2-runner | |
uses: machulav/ec2-github-runner@v2 | |
with: | |
mode: start | |
github-token: ${{ secrets.GROUP_1_GH_PERSONAL_ACCESS_TOKEN }} | |
ec2-image-id: ${{ vars.AWS_GROUP_1_IMAGE }} | |
ec2-instance-type: ${{ vars.AWS_EC2_TYPE }} | |
subnet-id: ${{ vars.AWS_SUBNET_IP }} | |
security-group-id: ${{ vars.AWS_SG_1 }} | |
- name: Start benchmark EC2 runner | |
id: start-benchmark-ec2-runner | |
uses: machulav/ec2-github-runner@v2 | |
with: | |
mode: start | |
github-token: ${{ secrets.GROUP_1_GH_PERSONAL_ACCESS_TOKEN }} | |
ec2-image-id: ${{ vars.AWS_GROUP_1_IMAGE }} | |
ec2-instance-type: ${{ vars.AWS_EC2_TYPE }} | |
subnet-id: ${{ vars.AWS_SUBNET_IP }} | |
security-group-id: ${{ vars.AWS_SG_1 }} | |
- name: Get private IP address | |
id: get-private-ip | |
run: | | |
echo "private-ip=$(aws ec2 describe-instances \ | |
--instance-id ${{ steps.start-server-ec2-runner.outputs.ec2-instance-id }} \ | |
--query 'Reservations[0].Instances[0].PrivateIpAddress' | tr -d '"')" \ | |
>> $GITHUB_OUTPUT | |
run-server: | |
name: Start the Parpulse server | |
needs: start-runner # required to start the main job when the runner is ready | |
runs-on: ${{ needs.start-runner.outputs.server-label }} # run the job on the newly created runner | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.GROUP_1_S3_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.GROUP_1_S3_SECRET_ACCESS_KEY }} | |
SERVER_IP: ${{ needs.start-runner.outputs.private-ip }} | |
steps: | |
- name: Clone Server | |
uses: actions/checkout@v4 | |
with: | |
repository: cmu-db/15721-s24-cache1 | |
ref: lkl/benchmark | |
- name: Build Server | |
run: cargo build --package storage-node --bin storage_node | |
- name: Run Server | |
run: | | |
cargo run --package storage-node --bin storage_node & | |
- name: Spin and wait for the Client | |
run: sleep 60 | |
run-benchmark: | |
name: Run Benchmark | |
needs: | |
- start-runner | |
runs-on: ${{ needs.start-runner.outputs.benchmark-label }} # run the job on the newly created runner | |
env: | |
SERVER_URL: http://${{ needs.start-runner.outputs.private-ip }}:3030 | |
steps: | |
- name: Clone Server | |
uses: actions/checkout@v4 | |
with: | |
ref: cache1-bench | |
- name: Build Benchmark driver | |
run: cargo build | |
- name: Wait for server | |
run: | | |
until curl --output /dev/null --silent --head --fail $SERVER_URL/heartbeat; do | |
printf '.' | |
sleep 5 | |
done | |
- name: Run Benchmark | |
run: cargo run | |
stop-runner: | |
name: Stop self-hosted EC2 runner | |
needs: | |
- start-runner # required to get output from the start-runner job | |
- run-server # required to wait when the main job is done | |
- run-benchmark | |
runs-on: ubuntu-latest | |
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.GROUP_1_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.GROUP_1_AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Stop Server EC2 runner | |
uses: machulav/ec2-github-runner@v2 | |
with: | |
mode: stop | |
github-token: ${{ secrets.GROUP_1_GH_PERSONAL_ACCESS_TOKEN }} | |
label: ${{ needs.start-runner.outputs.server-label }} | |
ec2-instance-id: ${{ needs.start-runner.outputs.server-ec2-instance-id }} | |
- name: Stop Benchmark EC2 runner | |
uses: machulav/ec2-github-runner@v2 | |
with: | |
mode: stop | |
github-token: ${{ secrets.GROUP_1_GH_PERSONAL_ACCESS_TOKEN }} | |
label: ${{ needs.start-runner.outputs.benchmark-label }} | |
ec2-instance-id: ${{ needs.start-runner.outputs.benchmark-ec2-instance-id }} | |