diff --git a/notebooks/scenarios/bigquery/job_helpers.py b/notebooks/scenarios/bigquery/job_helpers.py index 3d83a4f05a6..804a218f962 100644 --- a/notebooks/scenarios/bigquery/job_helpers.py +++ b/notebooks/scenarios/bigquery/job_helpers.py @@ -321,6 +321,9 @@ def load_jobs(users, high_client, filepath="./jobs.json"): data = {} jobs_list = [] for user in users: + if user.email not in data: + print(f"{user.email} missing from jobs") + continue user_jobs = data[user.email] for user_job in user_jobs: test_job = TestJob(**user_job) diff --git a/scripts/reset_k8s.sh b/scripts/reset_k8s.sh new file mode 100755 index 00000000000..d0d245be6f2 --- /dev/null +++ b/scripts/reset_k8s.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# WARNING: this will drop the 'app' database in your mongo-0 instance in the syft namespace +echo $1 + +# Dropping the database on mongo-0 +if [ -z $1 ]; then + MONGO_POD_NAME="mongo-0" +else + MONGO_POD_NAME=$1 +fi + +DROPCMD="<&1 + +# Resetting the backend pod +BACKEND_POD=$(kubectl get pods -n syft -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep -E ".*backend.*") +if [ -n "$BACKEND_POD" ]; then + kubectl delete pod -n syft $BACKEND_POD + echo "Backend pod $BACKEND_POD has been deleted and will be restarted." +else + echo "No backend pod found." +fi + +# Deleting StatefulSets that end with -pool +POOL_STATEFULSETS=$(kubectl get statefulsets -n syft -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep -E ".*-pool$") +if [ -n "$POOL_STATEFULSETS" ]; then + for STATEFULSET in $POOL_STATEFULSETS; do + kubectl delete statefulset -n syft $STATEFULSET + echo "StatefulSet $STATEFULSET has been deleted." + done +else + echo "No StatefulSets ending with '-pool' found." +fi + +# wait for backend to come back up +bash packages/grid/scripts/wait_for.sh service backend --namespace syft