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
31 changes: 0 additions & 31 deletions .github/find-api-model-versions.py

This file was deleted.

6 changes: 0 additions & 6 deletions .github/install-jq.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
set -e

# Google Cloud Workflow execution script
# Usage: ./request-simulation-model-versions.sh -b <bucket_name> -us <us_version> -uk <uk_version> [-t timeout] [-i interval]
# Usage: ./wait_for_country_versions.sh -b <bucket_name> -us <us_version> -uk <uk_version> [-t timeout] [-i interval]

usage() {
echo "Usage: $0 -us <us_version> -uk <uk_version> [-t timeout] [-i interval]"
echo "Usage: $0 -b <bucket_name> -us <us_version> -uk <uk_version> [-t timeout] [-i interval]"
echo ""
echo "Required flags:"
echo " -b bucket_name - GCS bucket name"
Expand All @@ -19,8 +19,8 @@ usage() {
echo " -h help - Show this help message"
echo ""
echo "Example:"
echo " $0 -us v1.2.3 -uk v1.2.4"
echo " $0 -us v1.2.3 -uk v1.2.4 -t 600 -i 15"
echo " $0 -b my-bucket -us v1.2.3 -uk v1.2.4"
echo " $0 -b my-bucket -us v1.2.3 -uk v1.2.4 -t 600 -i 15"
exit 1
}

Expand All @@ -34,9 +34,6 @@ CHECK_INTERVAL="10"
# Parse command line arguments
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
usage
;;
-b)
if [ -z "$2" ]; then
echo "Error: -b requires a bucket name"
Expand Down Expand Up @@ -88,7 +85,7 @@ while [ $# -gt 0 ]; do
done

# Validate required arguments
if [ -z "$BUCKET_NAME" ] || -z "$US_VERSION" ] || [ -z "$UK_VERSION" ]; then
if [ -z "$BUCKET_NAME" ] || [ -z "$US_VERSION" ] || [ -z "$UK_VERSION" ]; then
echo "Error: Missing required arguments"
echo "bucket_name (-b), us_version (-us), and uk_version (-uk) are required"
usage
Expand All @@ -101,10 +98,15 @@ if ! [[ "$TIMEOUT_SECONDS" =~ ^[0-9]+$ ]] || ! [[ "$CHECK_INTERVAL" =~ ^[0-9]+$
fi

# Configuration
PROJECT_ID="prod-api-v2-c4d5"
WORKFLOW_LOCATION="us-central1"
PROJECT_ID="${GOOGLE_CLOUD_PROJECT:-$(gcloud config get-value project 2>/dev/null)}"
WORKFLOW_LOCATION="${WORKFLOW_LOCATION:-us-central1}"
WORKFLOW_NAME="wait-for-country-packages"

if [ -z "$PROJECT_ID" ]; then
echo "Error: Could not determine project ID. Set GOOGLE_CLOUD_PROJECT environment variable."
exit 1
fi

echo "Starting workflow execution..."
echo "Project: $PROJECT_ID"
echo "Location: $WORKFLOW_LOCATION"
Expand Down Expand Up @@ -132,7 +134,6 @@ echo "Input: $INPUT_JSON"
# Execute workflow
echo "Executing workflow..."
EXECUTION_RESULT=$(gcloud workflows execute "$WORKFLOW_NAME" \
--project="$PROJECT_ID" \
--location="$WORKFLOW_LOCATION" \
--data="$INPUT_JSON" \
--format="json")
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies (required for finding API model versions)
run: make install
- name: Install jq (required only for GitHub Actions)
run: ".github/install-jq.sh"
- name: Find API model versions and write to environment variable
run: python3 .github/find-api-model-versions.py
- name: Ensure full API and simulation API model versions are in sync
run: ".github/request-simulation-model-versions.sh -b prod-api-v2-c4d5-metadata -us ${{ env.US_VERSION }} -uk ${{ env.UK_VERSION }}"
- name: GCP authentication
uses: "google-github-actions/auth@v2"
with:
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:
- Reverted a previous PR.
28 changes: 17 additions & 11 deletions policyengine_api/jobs/calculate_economy_simulation_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,23 @@ def run(
progress_log.model_dump(mode="json"), severity="INFO"
)
except Exception as e:
trace = traceback.format_exc()
# Send error log to GCP
error_log: V2V1Comparison = V2V1Comparison.model_validate(
{
**comparison_data,
"v2_error": trace,
}
)
logger.log_struct(
error_log.model_dump(mode="json"), severity="ERROR"
)
try:
trace = traceback.format_exc()
# Send error log to GCP
error_log: V2V1Comparison = (
V2V1Comparison.model_validate(
{
**comparison_data,
"v2_error": trace,
}
)
)
logger.log_struct(
error_log.model_dump(mode="json"), severity="ERROR"
)
except Exception as e2:
print("Something really wrong.", e2)
pass

# Compute baseline economy
logger.log_struct(
Expand Down
Loading