Skip to content

Commit

Permalink
Add script to verify async indexing configured
Browse files Browse the repository at this point in the history
  • Loading branch information
rlmanrique committed Dec 16, 2024
1 parent b09e589 commit cf1cffe
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ann_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ echo "Building all required containers"
( cd apps/ann-benchmarks/ && docker build -t ann_benchmarks . )

echo "Starting Weaviate..."
echo "ASYNC_INDEXING: $ASYNC_INDEXING"
docker compose -f apps/weaviate-no-restart-on-crash/docker-compose.yml up -d

wait_weaviate

echo "Current directory: $PWD"
echo "Exising files in current directory: $(ls -la)"

echo "Printing environment variables"
apt install python3-pip -y
python3 -m pip install docker
python3 get_env_var.py

echo "Run benchmark script"
mkdir -p datasets
(
Expand Down
3 changes: 2 additions & 1 deletion ann_benchmark_gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ gcloud compute ssh --zone $ZONE $instance -- "mkdir -p ~/apps/"
gcloud compute scp --zone $ZONE --recurse apps/ann-benchmarks "$instance:~/apps/"
gcloud compute scp --zone $ZONE --recurse apps/weaviate-no-restart-on-crash/ "$instance:~/apps/"
gcloud compute scp --zone $ZONE --recurse ann_benchmark.sh "$instance:~"
gcloud compute ssh --zone $ZONE $instance -- "DATASET=$DATASET DISTANCE=$DISTANCE REQUIRED_RECALL=$REQUIRED_RECALL WEAVIATE_VERSION=$WEAVIATE_VERSION MACHINE_TYPE=$MACHINE_TYPE CLOUD_PROVIDER=$CLOUD_PROVIDER OS=$OS bash ann_benchmark.sh"
gcloud compute scp --zone $ZONE --recurse get_env_var.py "$instance:~"
gcloud compute ssh --zone $ZONE $instance -- "ASYNC_INDEXING=$ASYNC_INDEXING DATASET=$DATASET DISTANCE=$DISTANCE REQUIRED_RECALL=$REQUIRED_RECALL WEAVIATE_VERSION=$WEAVIATE_VERSION MACHINE_TYPE=$MACHINE_TYPE CLOUD_PROVIDER=$CLOUD_PROVIDER OS=$OS bash ann_benchmark.sh"
mkdir -p results
gcloud compute scp --zone $ZONE --recurse "$instance:~/results/*.json" results/
1 change: 1 addition & 0 deletions apps/ann-benchmarks/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ loguru==0.5.3
seaborn==0.12.2
h5py==3.11.0
pandas==2.2.2
docker==7.1.0
25 changes: 25 additions & 0 deletions apps/get_env_var.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import docker

def get_env_variables(partial_image_name):
client = docker.from_env()
# List all running containers
containers = client.containers.list()

# Filter containers where the image name matches the partial name
matching_containers = [
container for container in containers if partial_image_name in container.image.tags[0]
]

if not matching_containers:
print(f"No running containers found matching image name: {partial_image_name}")
return

# Retrieve and print environment variables for each matching container
for container in matching_containers:
print(f"Environment variables for container {container.short_id}:")
exec_result = container.exec_run("env", stdout=True, stderr=True)
print(exec_result.output.decode())
print("--------------------------------------------")

# Replace with a partial image name
get_env_variables("weaviate")
22 changes: 22 additions & 0 deletions get_env_var.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import docker

def get_env_variables(partial_image_name):
client = docker.from_env()
containers = client.containers.list()

matching_containers = [
container for container in containers if partial_image_name in container.image.tags[0]
]

if not matching_containers:
print(f"No running containers found matching image name: {partial_image_name}")
return

for container in matching_containers:
print(f"Environment variables for container {container.short_id}:")
exec_result = container.exec_run("env", stdout=True, stderr=True)
print(exec_result.output.decode())
print("--------------------------------------------")

get_env_variables("weaviate")

0 comments on commit cf1cffe

Please sign in to comment.