Skip to content

Commit d6eedf5

Browse files
authored
Merge pull request #229 from cmu-delphi/dev/rebase-jhu-deploy
Fix JHU deployment history
2 parents c016072 + 69ff86b commit d6eedf5

File tree

7 files changed

+47
-16
lines changed

7 files changed

+47
-16
lines changed

ansible/files/jhu-params-prod.json renamed to ansible/templates/jhu-params-prod.json.j2

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@
33
"static_file_dir": "./static",
44
"export_dir": "/common/covidcast/receiving/jhu-csse/",
55
"cache_dir": "./cache",
6-
"base_url": "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_{metric}_US.csv"
6+
"base_url": "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_{metric}_US.csv",
7+
"aws_credentials": {
8+
"aws_access_key_id": "{{ delphi_aws_access_key_id }}",
9+
"aws_secret_access_key": "{{ delphi_aws_secret_access_key }}"
10+
},
11+
"bucket_name": "delphi-covidcast-indicator-output"
712
}

ansible/vars.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ pyenv_python_path: "/home/{{ runtime_user }}/.pyenv/versions/{{ python_version }
99

1010
# Indicators variables.
1111
google_health_api_key: "{{ vault_google_health_api_key }}"
12+
delphi_aws_access_key_id: "{{ vault_delphi_aws_access_key_id }}"
13+
delphi_aws_secret_access_key: "{{ vault_delphi_aws_secret_access_key }}"
14+

ansible/vault.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
35386139306136373731386533393535343530623035366532343334326430313839336334646363
3-
6630646235616664386630623565363262643965376563660a386639663436616635323630356430
4-
35613139666439363161613232346463366637623238623963623364366166356131346363656432
5-
3831636539306230660a656430623166663262316230333137613633333337623338393837643331
6-
34306335636231366135383163336435613130396265333434623361376531396138353163653265
7-
33363963363032326164323161323036326436616333303738373866623335623664316565653461
8-
63646536633161623937363062663031353734303539343332633365326333353537316336383461
9-
64353265303234346633
2+
66386163643862646634343162646465663762643034303563333833633661333932646164656462
3+
6166646131623132393238336263623562373065643633310a663232373237396361623462613333
4+
62373663383565623263306539636431623230633065626363666531366662363065343066363031
5+
3738616663336665340a326138333634306137363837396366303861663064326333613662656630
6+
62306331646637326637363766366237663037306665343761643263646663316535343561623137
7+
63313365653535393639626465343232396261643239303430383138633135346466323834336665
8+
33633064353034613836313265613466623961373565363835343430373138376336363966316365
9+
35663664396436313432376264316663326130306134326231303234393561643436623039613136
10+
63366638396262383762383336643930343661636461646162653734336334306239383132643435
11+
39333665643738643966356431333830646561353263353063326330643731616130396466343339
12+
39346437653063303336626663623835613938633834396430353634383366386237353862643766
13+
37393738353231666565303031393839306463373461393761653866653330646534393832303264
14+
30323038646166366465396235623731343539313633326539663966333437623733626131653437
15+
62326632656462383835656235373664366566343866383938343639613737623631616231616135
16+
633863383761366461363532353137323936

google_health/delphi_google_health/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def run_module():
2424
testing purposes).
2525
"""
2626

27-
#  read parameters
27+
# read parameters
2828
params = read_params()
2929
ght_key = params["ght_key"]
3030
start_date = params["start_date"]
@@ -51,7 +51,7 @@ def run_module():
5151
# setup class to handle API calls
5252
ght = GoogleHealthTrends(ght_key=ght_key)
5353

54-
#  read data frame version of the data
54+
# read data frame version of the data
5555
df_state = get_counts_states(
5656
ght, start_date, end_date, static_dir=static_dir, cache_dir=cache_dir
5757
)
@@ -64,7 +64,7 @@ def run_module():
6464

6565
for signal in signal_names:
6666
if signal.endswith(SMOOTHED):
67-
#  export each geographic region, with both smoothed and unsmoothed data
67+
# export each geographic region, with both smoothed and unsmoothed data
6868
export_csv(df_state, STATE, signal, smooth=True, receiving_dir=export_dir)
6969
export_csv(df_dma, DMA, signal, smooth=True, receiving_dir=export_dir)
7070
export_csv(df_hrr, HRR, signal, smooth=True, receiving_dir=export_dir)

jhu/params.json.template

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"base_url": "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_{metric}_US.csv",
77
"aws_credentials": {
88
"aws_access_key_id": "",
9-
"aws_secret_access_key": "",
10-
}
9+
"aws_secret_access_key": ""
10+
},
11+
"bucket_name": ""
1112
}

jhu/tests/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# -*- coding: utf-8 -*-
22

3+
from boto3 import Session
4+
from moto import mock_s3
35
import pytest
46

57
from os import listdir, remove
68
from os.path import join
79

10+
from delphi_utils import read_params
811
from delphi_jhu.run import run_module
912

1013

@@ -14,4 +17,11 @@ def run_as_module():
1417
for fname in listdir("receiving"):
1518
remove(join("receiving", fname))
1619

17-
run_module()
20+
with mock_s3():
21+
# Create the fake bucket we will be using
22+
params = read_params()
23+
aws_credentials = params["aws_credentials"]
24+
s3_client = Session(**aws_credentials).client("s3")
25+
s3_client.create_bucket(Bucket=params["bucket_name"])
26+
27+
run_module()

jhu/tests/params.json.template

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@
33
"static_file_dir": "../static",
44
"export_dir": "./receiving",
55
"cache_dir": "./cache",
6-
"base_url": "test_data/small_{metric}.csv"
6+
"base_url": "test_data/small_{metric}.csv",
7+
"aws_credentials": {
8+
"aws_access_key_id": "FAKE_TEST_ACCESS_KEY_ID",
9+
"aws_secret_access_key": "FAKE_TEST_SECRET_ACCESS_KEY"
10+
},
11+
"bucket_name": "test-bucket"
712
}

0 commit comments

Comments
 (0)