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

fix: backend config setup #60

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion _nx_arangodb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_info():
"db_name": None,
"read_parallelism": None,
"read_batch_size": None,
"use_gpu": True,
"use_gpu": True, # Only usable if nx-cugraph is available
}

return d
Expand Down
6 changes: 5 additions & 1 deletion nx_arangodb/classes/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from networkx.exception import NetworkXError

import nx_arangodb as nxadb
from _nx_arangodb import get_info
from nx_arangodb.exceptions import (
DatabaseNotSet,
EdgeTypeAmbiguity,
Expand Down Expand Up @@ -379,14 +380,17 @@ def __set_arangodb_backend_config(
m = "Must set all environment variables to use the ArangoDB Backend with an existing graph" # noqa: E501
raise OSError(m)

if "arangodb" not in nx.config.backends:
default_config = get_info()["default_config"]
nx.config.backends.arangodb = nx.utils.Config(**default_config)

config = nx.config.backends.arangodb
config.host = self._host
config.username = self._username
config.password = self._password
config.db_name = self._db_name
config.read_parallelism = read_parallelism
config.read_batch_size = read_batch_size
config.use_gpu = True # Only used by default if nx-cugraph is available

def __set_edge_collections_attributes(self, attributes: set[str] | None) -> None:
if not attributes:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "nx-arangodb"
dynamic = ["version"]
description = "ArangoDB backend for NetworkX"
description = "ArangoDB backend to NetworkX"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "ArangoDB" },
Expand Down
Loading