Skip to content
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
22 changes: 20 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
folder: Chapter08
- name: chap9
folder: Chapter09
- name: chap10
folder: Chapter10
runs-on: ubuntu-latest
name: Image ${{ matrix.chapter.name }}
steps:
Expand All @@ -58,16 +60,32 @@ jobs:
KAGGLE_USERNAME: ${{ secrets.KAGGLE_USERNAME }}
KAGGLE_TOKEN: ${{ secrets.KAGGLE_TOKEN }}
run: |


docker network create my-network

# Start Neo4j if we are testing chapter 10
if [ "${{ matrix.chapter.name }}" == "chap10" ];
then
docker run --rm --detach --name neo4j \
--publish=7474:7474 --publish=7687:7687 \
--user="$(id -u):$(id -g)" \
--env NEO4J_AUTH=none \
--env NEO4J_PLUGINS='["graph-data-science"]' \
neo4j:5.26.0
docker network connect my-network neo4j
fi

mkdir -p data
chmod -R 777 data
docker run \
--rm --detach -v "$(pwd)/data:/data" \
--name graph-machine-learning-box \
--env KAGGLE_USERNAME=${KAGGLE_USERNAME} \
--env KAGGLE_KEY=${KAGGLE_TOKEN} \
--env NEO4J_HOST=neo4j \
graph-machine-learning:latest

docker network connect my-network graph-machine-learning-box

# Run tests
cd docker

Expand Down
44 changes: 18 additions & 26 deletions Chapter10/01_Neo4j_bindings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with open(\"./dataset/movieCreationQuery.txt\", \"rb\") as fid:\n",
"with open(\"movieCreationQuery.txt\", \"rb\") as fid:\n",
" lines = fid.readlines()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -39,7 +39,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -48,17 +48,20 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"uri = \"neo4j://localhost:7687\"\n",
"import os\n",
"host = os.environ.get(\"NEO4J_HOST\", \"localhost\")\n",
"\n",
"uri = f\"neo4j://{host}:7687\"\n",
"driver = GraphDatabase.driver(uri, auth=(\"neo4j\", \"neo5j\"))"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -68,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -85,7 +88,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -94,20 +97,9 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<Record count(*)=342>]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"with driver.session() as session:\n",
" result = session.read_transaction(run_query, query)\n",
Expand All @@ -123,7 +115,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -134,9 +126,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "ml-book-9",
"display_name": "chap10",
"language": "python",
"name": "ml-book-9"
"name": "chap10"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -148,7 +140,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
Loading
Loading