Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow containers to start before initializing. Improve example.sh. #34

Merged
merged 1 commit into from
Dec 31, 2023
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
6 changes: 6 additions & 0 deletions docker/start-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ fi
# Passing file contents to Neo4j container cypher via 'cat':
# https://neo4j.com/docs/operations-manual/current/docker/operations/

echo "[$SCRIPT_NAME][INFO] - waiting for containers..."
sleep 30
echo "[$SCRIPT_NAME][INFO] - initializing data..."

# Initialize Neo4j PhyloDB schema (creates indices and properties).
SCHEMA_QUERY_FILE="$PROJ_ROOT/scripts/init/init_schema.cypher"
cat $SCHEMA_QUERY_FILE | docker exec --interactive phylodb-neo4j sh -c "cypher-shell -u neo4j -p password" >/dev/null 2>&1
Expand All @@ -90,4 +94,6 @@ cat $SCHEMA_QUERY_FILE | docker exec --interactive phylodb-neo4j sh -c "cypher-s
DATA_QUERY_FILE="$PROJ_ROOT/scripts/init/init_data.cypher"
cat $DATA_QUERY_FILE | docker exec --interactive phylodb-neo4j sh -c "cypher-shell -u neo4j -p password" >/dev/null 2>&1

echo "[$SCRIPT_NAME][INFO] - done."

popd
8 changes: 5 additions & 3 deletions scripts/example/example.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ curl -v --location --request POST 'http://localhost:8080/projects?provider=googl
}'

# Set the project id.
PROJECT="CHANGE_ME"
PROJECT=$(curl -s --location --request GET 'http://localhost:8080/projects?provider=google' --header "Authorization: Bearer $TOKEN" | python3 -c "import sys, json; print(json.load(sys.stdin)[0]['id'])")
echo "Project: $PROJECT"

# List all datasets:
echo -n "Datasets: "
Expand All @@ -129,7 +130,8 @@ curl -v --location --request POST "http://localhost:8080/projects/$PROJECT/datas
}'

# Set dataset id:
DATASET="CHANGE_ME"
DATASET=$(curl -s --location --request GET "http://localhost:8080/projects/$PROJECT/datasets?provider=google" --header "Authorization: Bearer $TOKEN" | python3 -c "import sys, json; print(json.load(sys.stdin)[0]['id'])")
echo "Dataset: $DATASET"

# Load profiles:
curl -v --location --request POST "http://localhost:8080/projects/$PROJECT/datasets/$DATASET/profiles/files?provider=google" \
Expand Down Expand Up @@ -164,7 +166,7 @@ echo -n "Inferences: "
curl --location --request GET "http://localhost:8080/projects/$PROJECT/datasets/$DATASET/inferences?provider=google" \
--header "Authorization: Bearer $TOKEN"
echo
INFERENCE="CHANGE_ME"
INFERENCE=$(curl -s --location --request GET "http://localhost:8080/projects/$PROJECT/datasets/$DATASET/inferences?provider=google" --header "Authorization: Bearer $TOKEN" | python3 -c "import sys, json; print(json.load(sys.stdin)[0]['id'])")
echo -n "Inference: "
curl --location --request GET "http://localhost:8080/projects/$PROJECT/datasets/$DATASET/inferences/$INFERENCE?provider=google" \
--header "Authorization: Bearer $TOKEN"
Expand Down