-
-
Notifications
You must be signed in to change notification settings - Fork 145
Improve FERC EQR sensor, deployment, testability, & notifications #5273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
df5bdd9
513d30a
16c3041
0c571b9
3b91384
eb6d01a
bab8382
e3cc5b5
d1681c8
0a29d53
0ddf52c
905266e
5bf2ebf
22177e0
f13d673
1802109
f992ed5
27bc9c9
6d7787e
67d15f3
16b8632
896f5d2
41cbb43
0c8e6ab
3bc80c5
7787453
db0b0b4
fb5e3f1
96ddba9
297d5a6
73d26d1
2bccc9c
c478379
614d8e5
722a18f
77a40b5
7beffd3
c349d93
cf16c62
15e7532
800a14f
f4ccb34
285b448
a1c36af
31ef085
9f95f2a
c3b8bc9
e70f024
a76b05e
6e7ded9
ab0ead9
597576a
de5fba9
218bd38
b175823
3000560
ad75285
daea6d9
2fbcb20
68055c6
7b061ab
f112164
337e52e
4e190c6
351fee9
55f5ac8
634856d
d0c4653
8f81e9c
fb84fea
bf4be5e
b952f43
b542162
3a21c32
6c21f62
0613f09
6d98dfd
33163fc
67a45df
4081ebb
4a3eaf4
4e2b78b
490ba68
2810101
321a317
a56b591
22d1347
54e68c0
33fa5ad
5d12bcd
f15f0b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |
| "containerEnv": { | ||
| "PUDL_INPUT": "/workspaces/pudl-input", | ||
| "PUDL_OUTPUT": "/workspaces/pudl-output", | ||
| "PUDL_ROOT_PATH": "/workspaces/pudl", | ||
| "PUDL_FERCEQR_ARCHIVE_PATH": "/workspaces/pudl-input/archives.catalyst.coop/ferceqr/", | ||
| "DAGSTER_HOME": "/workspaces/dagster-home", | ||
| "ANTHROPIC_API_KEY": "${localEnv:ANTHROPIC_API_KEY}", | ||
| "GEMINI_API_KEY": "${localEnv:GEMINI_API_KEY}", | ||
|
|
@@ -52,6 +54,7 @@ | |
| "chat.agent.sandbox.enabled": "off", | ||
| "chat.tools.global.autoApprove": true, | ||
| "chat.agent.sandbox.allowUnsandboxedCommands": true, | ||
| "chat.permissions.default": "autoApprove", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. YOLO |
||
| "claudeCode.allowDangerouslySkipPermissions": true, | ||
| "claudeCode.initialPermissionMode": "bypassPermissions", | ||
| "evenBetterToml.taplo.path": "/home/ubuntu/.pixi/bin/taplo", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,21 +2,39 @@ | |
| name: build-deploy-ferceqr | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Parameters that let us test just a little bit of data while not clobbering the production outputs. |
||
| start_partition: | ||
| description: First partition (e.g. 2013q3). Optional. If set, requires end_partition. If both unset, process all available data. | ||
| required: false | ||
| type: string | ||
| end_partition: | ||
| description: Last partition (e.g. 2013q4). Optional. If set, requires start_partition. If both unset, process all available data. | ||
| required: false | ||
| type: string | ||
| deployment_mode: | ||
| description: Deployment target. If none, do not deploy the data. | ||
| required: false | ||
| default: test | ||
| type: choice | ||
| options: | ||
| - test | ||
| - production | ||
| - none | ||
| schedule: | ||
| - cron: "48 0 3 * *" # 00:48 UTC on the third of every month | ||
|
|
||
| env: | ||
| GCP_BILLING_PROJECT: ${{ secrets.GCP_BILLING_PROJECT }} | ||
| GCS_OUTPUT_BUCKET: gs://pudl.catalyst.coop/ferceqr | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These paths are replaced in favor of a configuration file that can specify any number of different deployment targets. |
||
| GCS_LOGS_BUCKET: gs://builds.catalyst.coop/ferceqr_logs | ||
| S3_OUTPUT_BUCKET: s3://pudl.catalyst.coop/ferceqr | ||
| BATCH_JOB_JSON: batch_job.json | ||
| BUILD_ID: "" | ||
| BATCH_JOB_ID: "" | ||
| PUDL_FERCEQR_DEPLOYMENT_CONFIG_PATH: "" | ||
| emoji: ":warning:" | ||
|
|
||
| jobs: | ||
| build_and_deploy_eqr: | ||
| name: Build Docker image, push to Docker Hub and deploy to Google Batch | ||
| build_and_deploy_ferceqr: | ||
| name: Kick off a FERC EQR build and deployment with Google Batch | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
@@ -27,6 +45,43 @@ jobs: | |
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set environment variables for the FERC EQR batch job | ||
| run: | | ||
| batch_job_id="$(date +%Y-%m-%d-%H%M)-$(git rev-parse --short HEAD)" | ||
| build_id="$(date +%Y-%m-%d-%H%M)-$(git rev-parse --short HEAD)-${{ github.ref_name }}" | ||
| case "${{ github.event_name == 'workflow_dispatch' && inputs.deployment_mode || 'production' }}" in | ||
| test) | ||
| ferceqr_config_path='/home/ubuntu/pudl/src/pudl/package_data/settings/ferceqr_test_deployment_targets.yml' | ||
| ;; | ||
| none) | ||
| ferceqr_config_path='' | ||
| ;; | ||
| *) | ||
| ferceqr_config_path='/home/ubuntu/pudl/src/pudl/package_data/settings/ferceqr_deployment_targets.yml' | ||
| ;; | ||
| esac | ||
| { | ||
| echo "BATCH_JOB_ID=$batch_job_id" | ||
| echo "BUILD_ID=$build_id" | ||
| echo "PUDL_FERCEQR_DEPLOYMENT_CONFIG_PATH=$ferceqr_config_path" | ||
| } >> "$GITHUB_ENV" | ||
| echo "BUILD_ID: $build_id" | ||
| echo "BATCH_JOB_ID: $batch_job_id" | ||
| echo "PUDL_FERCEQR_DEPLOYMENT_CONFIG_PATH: $ferceqr_config_path" | ||
|
|
||
| - name: Notify Zulip of FERC EQR build launch | ||
| if: ${{ always() }} | ||
| uses: zulip/github-actions-zulip/send-message@v2 | ||
| with: | ||
| api-key: ${{ secrets.ZULIP_API_KEY }} | ||
| email: "build-status-bot@catalyst-cooperative.zulipchat.com" | ||
| organization-url: "https://catalyst-cooperative.zulipchat.com" | ||
| type: "stream" | ||
| to: "pudl-deployments" | ||
| topic: "build-deploy-ferceqr" | ||
| content: > | ||
| :rocket: Launching FERC EQR Build: ${{ env.BUILD_ID }}; :bulls_eye: Target: ${{ inputs.deployment_mode }} | ||
|
|
||
| - name: Docker Metadata | ||
| id: docker_metadata | ||
| uses: docker/metadata-action@v6 | ||
|
|
@@ -59,30 +114,17 @@ jobs: | |
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - id: "auth" | ||
| - name: Authenticate with Google Cloud | ||
| id: "gcloud-auth" | ||
| uses: "google-github-actions/auth@v3" | ||
| with: | ||
| workload_identity_provider: "projects/345950277072/locations/global/workloadIdentityPools/gh-actions-pool/providers/gh-actions-provider" | ||
| service_account: "deploy-pudl-github-action@catalyst-cooperative-pudl.iam.gserviceaccount.com" | ||
|
|
||
| - name: Set action environment variables | ||
| run: | | ||
| { | ||
| echo "BATCH_JOB_ID=$(date +%Y-%m-%d-%H%M)-$(git rev-parse --short HEAD)"; | ||
| echo "BUILD_ID=$(date +%Y-%m-%d-%H%M)-$(git rev-parse --short HEAD)-${{ github.ref_name }}"; | ||
| } >> "$GITHUB_ENV" | ||
|
|
||
| - name: Show freshly set envvars | ||
| run: | | ||
| echo "BUILD_ID: $BUILD_ID" | ||
| echo "BATCH_JOB_ID: $BATCH_JOB_ID" | ||
|
|
||
| # Setup gcloud CLI | ||
| - name: Set up Cloud SDK | ||
| - name: Set up Google Cloud SDK | ||
| id: "gcloud-sdk" | ||
| uses: google-github-actions/setup-gcloud@v3 | ||
|
|
||
| # Deploy PUDL image to GCE | ||
| # Dagster Postgres connection configured in builds/dagster.yaml - otherwise we get a str for port num | ||
|
Comment on lines
-84
to
-85
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've removed the postgresql DB since it turns out it's no longer necessary. |
||
| - name: Make GCP Batch config file | ||
| run: |- | ||
| ./devtools/generate_batch_config.py \ | ||
|
|
@@ -96,32 +138,22 @@ jobs: | |
| --container-env AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ | ||
| --container-env BUILD_REF=${{ github.ref_name }} \ | ||
| --container-env BUILD_ID=${{ env.BUILD_ID }} \ | ||
| --container-env FERCEQR_START_PARTITION=${{ github.event_name == 'workflow_dispatch' && inputs.start_partition || '' }} \ | ||
| --container-env FERCEQR_END_PARTITION=${{ github.event_name == 'workflow_dispatch' && inputs.end_partition || '' }} \ | ||
|
Comment on lines
+141
to
+142
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Necessary to be able to process just a little bit of EQR. As a treat. |
||
| --container-env FERCEQR_BUILD=true \ | ||
| --container-env PUDL_FERCEQR_ARCHIVE_PATH=gs://archives.catalyst.coop/ferceqr/published \ | ||
| --container-env PUDL_FERCEQR_DEPLOYMENT_CONFIG_PATH="${{ env.PUDL_FERCEQR_DEPLOYMENT_CONFIG_PATH }}" \ | ||
| --container-env ZULIP_API_KEY=${{ secrets.ZULIP_API_KEY }} \ | ||
| --container-env GCP_BILLING_PROJECT=${{ secrets.GCP_BILLING_PROJECT }} \ | ||
| --container-env GCS_OUTPUT_BUCKET=${{ env.GCS_OUTPUT_BUCKET }} \ | ||
| --container-env GCS_LOGS_BUCKET=${{ env.GCS_LOGS_BUCKET }} \ | ||
| --container-env S3_OUTPUT_BUCKET=${{ env.S3_OUTPUT_BUCKET }} \ | ||
| --container-env GITHUB_ACTION_TRIGGER=${{ github.event_name }} \ | ||
| --container-env OMP_NUM_THREADS=4 \ | ||
| --container-env OMP_NUM_THREADS=8 \ | ||
| --container-env PUDL_BOT_PAT=${{ secrets.PUDL_BOT_PAT }} \ | ||
| --vcpu 16 \ | ||
| --mem-gb 127 \ | ||
| --disk-gb 1000 \ | ||
| --output ${{ env.BATCH_JOB_JSON }} | ||
|
|
||
| - name: Send notification to Zulip build status stream | ||
| if: ${{ always() }} | ||
| uses: zulip/github-actions-zulip/send-message@v2 | ||
| with: | ||
| api-key: ${{ secrets.ZULIP_API_KEY }} | ||
| email: "build-status-bot@catalyst-cooperative.zulipchat.com" | ||
| organization-url: "https://catalyst-cooperative.zulipchat.com" | ||
| type: "stream" | ||
| to: "pudl-deployments" | ||
| topic: "FERC EQR Builds" | ||
| content: > | ||
| :rocket: Launching FERC EQR Build: ${{ env.BUILD_ID }} | ||
|
|
||
| # Start the batch job | ||
| - name: Launch Google Batch job | ||
| run: gcloud batch jobs submit run-ferceqr-etl-${{ env.BATCH_JOB_ID }} --config ${{ env.BATCH_JOB_JSON }} --location us-east1 | ||
|
|
||
|
|
@@ -143,6 +175,6 @@ jobs: | |
| organization-url: "https://catalyst-cooperative.zulipchat.com" | ||
| type: "stream" | ||
| to: "pudl-deployments" | ||
| topic: "FERC EQR Builds" | ||
| topic: "build-deploy-ferceqr" | ||
| content: > | ||
| ${{ env.emoji }} Google Batch job for ${{ env.BUILD_ID }} launched with status: ${{ job.status }}. | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,8 +45,10 @@ ENV DAGSTER_HOME=${CONTAINER_PUDL_WORKSPACE}/dagster_home | |
|
|
||
| RUN mkdir -p ${PUDL_INPUT} ${PUDL_OUTPUT} ${DAGSTER_HOME} ${PUDL_ROOT_PATH} | ||
|
|
||
| # Copy dagster configuration file | ||
| COPY builds/dagster.yaml ${DAGSTER_HOME}/dagster.yaml | ||
| # Copy job-specific dagster configuration files; each batch script selects | ||
| # the appropriate one at startup by copying it to $DAGSTER_HOME/dagster.yaml. | ||
| COPY builds/dagster-pudl.yaml ${DAGSTER_HOME}/dagster-pudl.yaml | ||
| COPY builds/dagster-ferceqr.yaml ${DAGSTER_HOME}/dagster-ferceqr.yaml | ||
|
Comment on lines
+50
to
+51
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the moment these need different dagster configurations. The individual scripts rename their respective config file to |
||
|
|
||
| # Copy the entire PUDL repo into the image. | ||
| # We can't install the PUDL package without .git/ because the version is dynamically | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| run_coordinator: | ||
| module: dagster | ||
| class: QueuedRunCoordinator | ||
| config: | ||
| max_concurrent_runs: 10 |
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously this had the postgresql setup in it, but it turns out that SQLite now works fine for Dagster's event logging, so we don't need postgres any more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool that this is working with SQLite. Without the postgres setup we might be able to migrate everything into python.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for shits and giggles I tried disabling postgres on the PUDL build too, and it also worked fine with SQLite. |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an ad-hoc path but I needed it to be somehwere inside the container for testing and this seemed better than creating a whole new mount. Also not a terrible path to adopt more broadly for stuff that we need to pull from our GCS archives bucket.