This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (132 loc) · 5.21 KB
/
benchmark_group_1.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: benchmark-group-1
on:
push:
branches:
- cache1-bench
pull_request:
branches:
- cache1-bench
workflow_dispatch:
jobs:
start-runner:
name: Start self-hosted EC2 runners
runs-on: ubuntu-latest
strategy:
matrix:
runner_type: ['server', 'benchmark']
outputs:
server-label: ${{ steps.start-runner-server.outputs.label }}
server-ec2-instance-id: ${{ steps.start-runner-server.outputs.ec2-instance-id }}
server-private-ip: ${{ steps.get-server-private-ip.outputs.private-ip }}
benchmark-label: ${{ steps.start-runner-benchmark.outputs.label }}
benchmark-ec2-instance-id: ${{ steps.start-runner-benchmark.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-runner-server
if: matrix.runner_type == 'server'
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-runner-benchmark
if: matrix.runner_type == 'benchmark'
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-server-private-ip
if: matrix.runner_type == 'server'
run: |
echo "server-private-ip=$(aws ec2 describe-instances \
--instance-id ${{ steps.start-runner-server.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 # Should not compile from scratch
- name: Run Server
run: |
cargo run --package storage-node --bin storage_node
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
- name: Stop Server
run: |
curl -X POST $SERVER_URL/shutdown
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 }}