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
2 changes: 1 addition & 1 deletion .github/scripts/deploy_app_engine_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ if [[ "${APP_ENGINE_PROMOTE}" != "1" ]]; then
deploy_args+=("--no-promote")
fi

yes | gcloud app deploy "${deploy_args[@]}"
gcloud app deploy --quiet "${deploy_args[@]}"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ brew install redis
redis-server
```

2. Start the API service worker
2. Start the API

Run the below

```
FLASK_DEBUG=1 python policyengine_api/worker.py
FLASK_DEBUG=1 python -m flask --app policyengine_api.api run
```

NOTE: Calculations are not possible in the uk app without access to a specific dataset. Expect an error: "ValueError: Invalid response code 404 for url https://api.github.com/repos/policyengine/non-public-microdata/releases/tags/uk-2024-march-efo."
Expand Down
1 change: 1 addition & 0 deletions changelog.d/app-engine-deploy-quiet.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed staged App Engine deploy automation to use `gcloud app deploy --quiet` instead of piping `yes`, preventing false CI failures after successful deployments. Also removed stale runtime, test-fixture, and README references to a nonexistent `policyengine_api/worker.py` process.
12 changes: 1 addition & 11 deletions gcp/policyengine_api/start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh
# Environment variables
PORT="${PORT:-8080}"
WORKER_COUNT="${WORKER_COUNT:-3}"
REDIS_PORT="${REDIS_PORT:-6379}"

# Start the API
Expand All @@ -15,16 +14,7 @@ redis-server --protected-mode no \
# Wait for Redis to be ready
sleep 2

# Start multiple workers using POSIX-compliant loop
i=1
while [ $i -le "$WORKER_COUNT" ]
do
echo "Starting worker $i..."
python3 policyengine_api/worker.py &
i=$((i + 1))
done

# Keep the script running and handle shutdown gracefully
trap "pkill -P $$; exit 1" INT TERM

wait
wait
5 changes: 2 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ def client():
with running(["redis-server"], 3):
redis_client = redis.Redis()
redis_client.ping()
with running([sys.executable, "policyengine_api/worker.py"], 3):
with app.test_client() as test_client:
yield test_client
with app.test_client() as test_client:
yield test_client
Loading