GoogleCloudPlatform / ai-on-gke

AI on GKE is a collection of examples, best-practices, and prebuilt solutions to help build, deploy, and scale AI Platforms on Google Kubernetes Engine
Apache License 2.0
194 stars 143 forks source link

Better error message/handling when no test_data is available in locust worker #673

Closed hubatish closed 2 months ago

hubatish commented 2 months ago

Locust worker handling GCS requests were not sending a nice error message when no test_data was available, rather just throwing lots of "0 is an invalid value for random.randrange(0, len(test_data))" errors. Minor refactor to use the same code for HTTP & GCS request error handling.

Tested this with terraform destroy + apply & giving this exception in locust: https://imgur.com/a/p1ZdM87 An exception is more helpful than just a log since it shows up here nicely. I also got an error in run.sh / load_data.py, but that doesn't stop the worker from trying to respond to requests, so both error messages are needed.

..also sneaking in the addition of private_cluster_config to infra/stage-1/main.tf. Likely I broke this again in https://github.com/GoogleCloudPlatform/ai-on-gke/commit/70fe82b1ec4bd46adfbf2df2c62cb12403a314dd . This worked in my local, but that's because I had the extra file changed in my local & missed committing it.