Skip to content

Commit

Permalink
Fix cloud access bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilwoodruff committed Sep 16, 2024
1 parent 992e89b commit 3fb10cb
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci_cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Download data inputs
run: make download
env:
POLICYENGINE_US_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_UK_DATA_GITHUB_TOKEN }}
POLICYENGINE_UK_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_UK_DATA_GITHUB_TOKEN }}
- name: Build datasets
run: make data
- name: Run tests
Expand All @@ -83,9 +83,9 @@ jobs:
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build container
run: docker build . -f docker/policyengine_us_data.Dockerfile -t ghcr.io/policyengine/policyengine-us-data:latest
run: docker build . -f docker/policyengine_uk_data.Dockerfile -t ghcr.io/policyengine/policyengine-uk-data:latest
- name: Push container
run: docker push ghcr.io/policyengine/policyengine-us-data:latest
run: docker push ghcr.io/policyengine/policyengine-uk-data:latest

upload:
name: Upload Data
Expand All @@ -106,10 +106,10 @@ jobs:
- name: Download data inputs
run: make download
env:
POLICYENGINE_US_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_US_DATA_GITHUB_TOKEN }}
POLICYENGINE_UK_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_UK_DATA_GITHUB_TOKEN }}
- name: Build datasets
run: make data
- name: Upload data
run: make upload
env:
POLICYENGINE_US_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_US_DATA_GITHUB_TOKEN }}
POLICYENGINE_UK_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_UK_DATA_GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions docs/Home.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import streamlit as st
from policyengine_uk_data.utils.download_docs_prerequisites import download_data
download_data()

st.set_page_config(layout="wide")

Expand Down
2 changes: 2 additions & 0 deletions docs/Pages/Methodology.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import streamlit as st
from policyengine_uk_data.utils.download_docs_prerequisites import download_data
download_data()

st.set_page_config(layout="wide")

Expand Down
2 changes: 2 additions & 0 deletions docs/Pages/Validation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import streamlit as st
from policyengine_uk_data.utils.download_docs_prerequisites import download_data
download_data()

st.set_page_config(layout="wide")

Expand Down
1 change: 1 addition & 0 deletions policyengine_uk_data/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
from .uprating import *
from .datasets import *
from .loss import *
from .download_docs_prerequisites import *
25 changes: 25 additions & 0 deletions policyengine_uk_data/utils/download_docs_prerequisites.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from policyengine_us_data.utils.github import download
from policyengine_us_data.data_storage import STORAGE_FOLDER

PREREQUISITES = [
{
"repo": "ukda",
"file_name": "frs_2022_23.h5",
},
{
"repo": "ukda",
"file_name": "enhanced_frs_2022_23.h5",
},
]


def download_data():
for prerequisite in PREREQUISITES:
if not (STORAGE_FOLDER / prerequisite["file_name"]).exists():
download(
"PolicyEngine",
prerequisite["repo"],
"release",
prerequisite["file_name"],
STORAGE_FOLDER / prerequisite["file_name"],
)
2 changes: 1 addition & 1 deletion policyengine_uk_data/utils/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time

auth_headers = {
"Authorization": f"token {os.environ.get('POLICYENGINE_US_DATA_GITHUB_TOKEN')}",
"Authorization": f"token {os.environ.get('POLICYENGINE_UK_DATA_GITHUB_TOKEN')}",
}


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies = [
dev = [
"black",
"pytest",
"policyengine_uk @ git+https://github.com/PolicyEngine/policyengine-uk.git@data-update",
"policyengine_uk>=1.8.0",
"streamlit",
]

Expand Down

0 comments on commit 3fb10cb

Please sign in to comment.