diff --git a/docker/start-docker.sh b/docker/start-docker.sh index 7f5b2aa..6a74e09 100755 --- a/docker/start-docker.sh +++ b/docker/start-docker.sh @@ -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 @@ -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 diff --git a/scripts/example/example.sh b/scripts/example/example.sh old mode 100644 new mode 100755 index 6b3aaca..6622415 --- a/scripts/example/example.sh +++ b/scripts/example/example.sh @@ -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: " @@ -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" \ @@ -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"