Skip to content

Commit

Permalink
Merge pull request #34 from phyloviz/devel
Browse files Browse the repository at this point in the history
Allow containers to start before initializing. Improve example.sh.
  • Loading branch information
aplf authored Dec 31, 2023
2 parents 74c7ad2 + 4c80072 commit 1f4f7ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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

0 comments on commit 1f4f7ea

Please sign in to comment.