Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/code_changes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
with:
args: ". -l 79 --check"
Test:
permissions:
contents: "read"
# Required to auth against gcp
id-token: "write"
runs-on: larger-runner
steps:
- name: Checkout repo
Expand All @@ -32,6 +36,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.11'
- uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: "projects/322898545428/locations/global/workloadIdentityPools/policyengine-research-id-pool/providers/prod-github-provider"
service_account: "policyengine-research@policyengine-research.iam.gserviceaccount.com"

- name: Install package
run: uv pip install -e .[dev] --system
Expand Down
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
fixed:
- Upload to GCP on dataset build.
19 changes: 18 additions & 1 deletion policyengine_us_data/storage/upload_completed_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
)
from policyengine_us_data.storage import STORAGE_FOLDER
from policyengine_us_data.utils.huggingface import upload
from google.cloud import storage


def upload_datasets():
for dataset in [EnhancedCPS_2024, Pooled_3_Year_CPS_2023, CPS_2023]:
storage_client = storage.Client()
bucket = storage_client.bucket("policyengine-us-data")

datasets_to_upload = [
EnhancedCPS_2024,
Pooled_3_Year_CPS_2023,
CPS_2023,
]

for dataset in datasets_to_upload:
dataset = dataset()
if not dataset.exists:
raise ValueError(
Expand All @@ -21,6 +31,13 @@ def upload_datasets():
dataset.file_path.name,
)

blob = dataset.file_path.name
blob = bucket.blob(blob)
blob.upload_from_filename(dataset.file_path)
print(
f"Uploaded {dataset.file_path.name} to GCS bucket policyengine-us-data."
)


if __name__ == "__main__":
upload_datasets()
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies = [
"microdf_python>=0.4.3",
"microimpute",
"pip-system-certs",
"google-cloud-storage",
]

[project.optional-dependencies]
Expand Down
Loading