Skip to content

Commit 6da4b20

Browse files
authored
Merge pull request #1336 from cmu-delphi/release/delphi-epidata-4.1.13
Release Delphi Epidata 4.1.13
2 parents 0279a57 + d8e91d3 commit 6da4b20

30 files changed

+508
-1082
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 4.1.12
2+
current_version = 4.1.13
33
commit = False
44
tag = False
55

.git-blame-ignore-revs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# style(black): format cdc acquisition
22
980b0b7e80c7923b79e14fee620645e680785703
3-
# style(black): format covidcast_nowcast acquisition
4-
9e6ff16f599e8feec34a08dd1bddbc5eae347b55
53
# style(black): format ecdc acquisition
64
d1141d904da4e62992b97c92d5caebd8fadffd42
75
# style(black): format flusurv acquisition
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: One-time performance testing - 26th October 2023
2+
3+
# Run "At every 30th minute on day-of-month 26 in October"
4+
on:
5+
schedule:
6+
- cron: '*/30 * 26 10 *'
7+
8+
# Add some extra perms to comment on a PR
9+
permissions:
10+
pull-requests: write
11+
contents: read
12+
13+
jobs:
14+
run-perftests:
15+
# Run this on Delphi's self-hosted runner
16+
runs-on: self-hosted
17+
outputs:
18+
request_count: ${{ steps.output.outputs.request_count }}
19+
failure_count: ${{ steps.output.outputs.failure_count }}
20+
med_time: ${{ steps.output.outputs.med_time }}
21+
avg_time: ${{ steps.output.outputs.avg_time }}
22+
min_time: ${{ steps.output.outputs.min_time }}
23+
max_time: ${{ steps.output.outputs.max_time }}
24+
requests_per_sec: ${{ steps.output.outputs.requests_per_sec }}
25+
steps:
26+
- name: Set up WireGuard
27+
uses: egor-tensin/[email protected]
28+
with:
29+
endpoint: '${{ secrets.WG_PERF_ENDPOINT }}'
30+
endpoint_public_key: '${{ secrets.WG_PERF_ENDPOINT_PUBLIC_KEY }}'
31+
ips: '${{ secrets.WG_PERF_IPS }}'
32+
allowed_ips: '${{ secrets.WG_PERF_ALLOWED_IPS }}'
33+
private_key: '${{ secrets.WG_PERF_PRIVATE_KEY }}'
34+
- name: Clean files from previous runs
35+
uses: AutoModality/action-clean@v1
36+
- name: Check out repository
37+
uses: actions/checkout@v3
38+
- name: Set up repository # mimics install.sh in the README except that delphi is cloned from the PR rather than main
39+
run: |
40+
cd ..
41+
rm -rf driver
42+
mkdir -p driver/repos/delphi
43+
cd driver/repos/delphi
44+
git clone https://github.com/cmu-delphi/operations
45+
git clone https://github.com/cmu-delphi/utils
46+
git clone https://github.com/cmu-delphi/flu-contest
47+
git clone https://github.com/cmu-delphi/nowcast
48+
cd ../../
49+
50+
cd ..
51+
cp -R delphi-epidata driver/repos/delphi/delphi-epidata
52+
cd -
53+
54+
ln -s repos/delphi/delphi-epidata/dev/local/Makefile
55+
- name: Build & run epidata
56+
run: |
57+
cd ../driver
58+
sudo make web sql="${{ secrets.DB_CONN_STRING }}" rate_limit="999999/second"
59+
sudo make redis
60+
- name: Check out delphi-admin
61+
uses: actions/checkout@v3
62+
with:
63+
repository: cmu-delphi/delphi-admin
64+
token: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }}
65+
path: delphi-admin
66+
- name: Build & run Locust
67+
continue-on-error: true # sometimes ~2-5 queries fail, we shouldn't end the run if that's the case
68+
run: |
69+
cd delphi-admin/load-testing/locust
70+
docker build -t locust .
71+
export CSV=v4-requests-small.csv
72+
touch output_stats.csv && chmod 666 output_stats.csv
73+
touch output_stats_history.csv && chmod 666 output_stats_history.csv
74+
touch output_failures.csv && chmod 666 output_failures.csv
75+
touch output_exceptions.csv && chmod 666 output_exceptions.csv
76+
docker run --net=host -v $PWD:/mnt/locust -e CSV="/mnt/locust/${CSV}" locust -f /mnt/locust/v4.py --host http://127.0.0.1:10080/ --users 10 --spawn-rate 1 --headless -i "$(cat ${CSV} | wc -l)" --csv=/mnt/locust/output
77+
- name: Produce output for summary
78+
id: output
79+
uses: jannekem/run-python-script-action@v1
80+
with:
81+
script: |
82+
import os
83+
84+
def write_string(name, value):
85+
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
86+
print(f'{name}={value}', file=fh)
87+
88+
def write_float(name, value):
89+
write_string(name, "{:.2f}".format(float(value)))
90+
91+
with open("delphi-admin/load-testing/locust/output_stats.csv", "r", encoding="utf-8", errors="ignore") as scraped:
92+
final_line = scraped.readlines()[-1].split(",")
93+
write_string('request_count', final_line[2])
94+
write_string('failure_count', final_line[3])
95+
write_float('med_time', final_line[4])
96+
write_float('avg_time', final_line[5])
97+
write_float('min_time', final_line[6])
98+
write_float('max_time', final_line[7])
99+
write_float('requests_per_sec', final_line[9])
100+
101+
- name: Archive results as artifacts
102+
uses: actions/upload-artifact@v3
103+
with:
104+
name: locust-output
105+
path: |
106+
delphi-admin/load-testing/locust/output_*.csv

.github/workflows/performance-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Build & run epidata
6464
run: |
6565
cd ../driver
66-
sudo make web sql="${{ secrets.DB_CONN_STRING }}"
66+
sudo make web sql="${{ secrets.DB_CONN_STRING }}" rate_limit="999999/second"
6767
sudo make redis
6868
- name: Check out delphi-admin
6969
uses: actions/checkout@v3

deploy.json

-9
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,6 @@
208208
"add-header-comment": true
209209
},
210210

211-
"// acquisition - covidcast_nowcast",
212-
{
213-
"type": "move",
214-
"src": "src/acquisition/covidcast_nowcast/",
215-
"dst": "[[package]]/acquisition/covidcast_nowcast/",
216-
"match": "^.*\\.(py)$",
217-
"add-header-comment": true
218-
},
219-
220211
"// maintenance",
221212
{
222213
"type": "move",

dev/local/Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
# test= Only runs tests in the directories provided here, e.g.
3838
# repos/delphi/delphi-epidata/tests/acquisition/covidcast
3939
# sql= Overrides the default SQL connection string.
40+
# rate_limit= Overrides the default rate limit for API requests.
4041

4142

4243
# Set optional argument defaults
@@ -56,6 +57,14 @@ else
5657
sqlalchemy_uri:=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
5758
endif
5859

60+
ifdef rate_limit
61+
# Notation found here: https://flask-limiter.readthedocs.io/en/stable/#rate-limit-string-notation
62+
rate_limit_settings:=--env "RATE_LIMIT=$(rate_limit)"
63+
else
64+
# Default behavior is to set the rate limit to "5/hour" for API key tests via this environment variable
65+
rate_limit_settings:=--env "TESTING_MODE=True"
66+
endif
67+
5968
SHELL:=/bin/sh
6069

6170
# Get the Makefile's absolute path: https://stackoverflow.com/a/324782/4784655
@@ -104,7 +113,7 @@ web:
104113
--env "REDIS_PASSWORD=1234" \
105114
--env "API_KEY_ADMIN_PASSWORD=test_admin_password" \
106115
--env "API_KEY_REGISTER_WEBHOOK_TOKEN=abc" \
107-
--env "TESTING_MODE=True" \
116+
$(rate_limit_settings) \
108117
--network delphi-net --name delphi_web_epidata \
109118
delphi_web_epidata >$(LOG_WEB) 2>&1 &
110119

dev/local/setup.cfg

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = Delphi Development
3-
version = 4.1.12
3+
version = 4.1.13
44

55
[options]
66
packages =
@@ -13,7 +13,6 @@ packages =
1313
delphi.epidata.acquisition.covid_hosp.state_daily
1414
delphi.epidata.acquisition.covid_hosp.state_timeseries
1515
delphi.epidata.acquisition.covidcast
16-
delphi.epidata.acquisition.covidcast_nowcast
1716
delphi.epidata.acquisition.ecdc
1817
delphi.epidata.acquisition.flusurv
1918
delphi.epidata.acquisition.fluview

integrations/acquisition/covidcast_nowcast/__init__.py

-4
This file was deleted.

integrations/acquisition/covidcast_nowcast/test_csv_uploading.py

-157
This file was deleted.

0 commit comments

Comments
 (0)