Skip to content

Commit

Permalink
Merge pull request #9246 from madhavajay/madhava/small_fix
Browse files Browse the repository at this point in the history
Fixed small issue with load_jobs
  • Loading branch information
madhavajay authored Sep 3, 2024
2 parents 83551b2 + 938e458 commit 0960a18
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions notebooks/scenarios/bigquery/job_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
42 changes: 42 additions & 0 deletions scripts/reset_k8s.sh
Original file line number Diff line number Diff line change
@@ -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="<<EOF
use app;
db.dropDatabase();
EOF"

FLUSH_COMMAND="mongosh -u root -p example $DROPCMD"
echo "$FLUSH_COMMAND" | kubectl exec -i -n syft $MONGO_POD_NAME -- bash 2>&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

0 comments on commit 0960a18

Please sign in to comment.