Skip to content

Commit

Permalink
Merge branch 'master' into housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
aMahanna committed Oct 17, 2023
2 parents a44a5d3 + 1887ddc commit f045a05
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 26 deletions.
70 changes: 70 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: 2.1

workflows:
python_ci:
jobs:
- lint
- test

jobs:
lint:
machine:
image: linux-cuda-11:default
resource_class: gpu.nvidia.small.multi
steps:
- checkout
- restore_cache:
key: pip-and-local-cache
- run:
name: Setup Python 3.10
command: pyenv install 3.10 && pyenv global 3.10
- run:
name: Install Dependencies
command: |
pip install --upgrade pip setuptools setuptools-scm wheel
pip install --extra-index-url=https://pypi.nvidia.com cudf-cu11 cugraph-cu11
pip install ".[dev]"
- run:
name: Run black
command: black --check --verbose --diff --color --config=pyproject.toml ./adbcug_adapter ./tests/
- run:
name: Run isort
command: isort --check ./adbcug_adapter ./tests/
# - run:
# name: Run mypy
# command: mypy ./adbcug_adapter ./tests
- run:
name: Run flake8
command: flake8 ./adbcug_adapter ./tests
- save_cache:
key: pip-and-local-cache
paths:
- ~/.local
- ~/.cache/pip

test:
machine:
image: linux-cuda-11:default
resource_class: gpu.nvidia.small.multi
steps:
- checkout
- restore_cache:
key: pip-and-local-cache
- run:
name: Setup Python 3.10
command: pyenv install 3.10 && pyenv global 3.10
- run:
name: Install Dependencies
command: |
pip install --upgrade pip setuptools setuptools-scm wheel
pip install --extra-index-url=https://pypi.nvidia.com cudf-cu11 cugraph-cu11
pip install ".[dev]"
- run:
name: Setup Docker
command: |
sudo systemctl start docker
docker create --name adb -p 8529:8529 -e ARANGO_ROOT_PASSWORD= arangodb/arangodb
docker start adb
- run:
name: Run PyTest
command: pytest --cov=adbcug_adapter --cov-report xml --cov-report term-missing -v --color=yes --no-cov-on-fail --code-highlight=yes
51 changes: 25 additions & 26 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
likes_adbcug_adapter: ADBCUG_Adapter


# def pytest_addoption(parser: Any) -> None:
# parser.addoption("--url", action="store", default="http://localhost:8529")
# parser.addoption("--dbName", action="store", default="_system")
# parser.addoption("--username", action="store", default="root")
# parser.addoption("--password", action="store", default="")
def pytest_addoption(parser: Any) -> None:
parser.addoption("--url", action="store", default="http://localhost:8529")
parser.addoption("--dbName", action="store", default="_system")
parser.addoption("--username", action="store", default="root")
parser.addoption("--password", action="store", default="")


def pytest_configure(config: Any) -> None:
# con = {
# "url": config.getoption("url"),
# "username": config.getoption("username"),
# "password": config.getoption("password"),
# "dbName": config.getoption("dbName"),
# }
con = {
"url": config.getoption("url"),
"username": config.getoption("username"),
"password": config.getoption("password"),
"dbName": config.getoption("dbName"),
}

# temporary workaround for build.yml purposes
con = get_temp_credentials()
# # temporary workaround for build.yml purposes
# con = get_temp_credentials()

print("----------------------------------------")
print("URL: " + con["url"])
Expand Down Expand Up @@ -90,19 +90,18 @@ def pytest_configure(config: Any) -> None:
)


def arango_restore(con: Json, path_to_data: str) -> None:
restore_prefix = "./assets/" if os.getenv("GITHUB_ACTIONS") else ""
protocol = "http+ssl://" if "https://" in con["url"] else "tcp://"
url = protocol + con["url"].partition("://")[-1]
def arango_restore(connection: Any, path_to_data: str) -> None:
protocol = "http+ssl://" if "https://" in connection["url"] else "tcp://"
url = protocol + connection["url"].partition("://")[-1]

subprocess.check_call(
f'chmod -R 755 ./assets/arangorestore && {restore_prefix}arangorestore \
-c none --server.endpoint {url} --server.database {con["dbName"]} \
--server.username {con["username"]} \
--server.password "{con["password"]}" \
f'chmod -R 755 ./tools/arangorestore && ./tools/arangorestore \
-c none --server.endpoint {url} --server.database {connection["dbName"]} \
--server.username {connection["username"]} \
--server.password "{connection["password"]}" \
--input-directory "{PROJECT_DIR}/{path_to_data}"',
cwd=f"{PROJECT_DIR}/tests",
shell=True,
shell=True, # nosec
)


Expand All @@ -119,7 +118,7 @@ def get_divisibility_graph() -> CUGGraph:

cug_graph = CUGMultiGraph(directed=True)
cug_graph.from_cudf_edgelist(
edges, source="src", destination="dst", edge_attr="quotient", renumber=False
edges, source="src", destination="dst", edge_attr="quotient"
)

return cug_graph
Expand All @@ -134,7 +133,7 @@ def get_bipartite_graph() -> CUGGraph:
)

cug_graph = CUGGraph()
cug_graph.from_cudf_edgelist(edges, source="src", destination="dst", renumber=False)
cug_graph.from_cudf_edgelist(edges, source="src", destination="dst")
return cug_graph


Expand All @@ -150,7 +149,7 @@ def get_drivers_graph() -> CUGGraph:
)

cug_graph = CUGGraph()
cug_graph.from_cudf_edgelist(edges, source="src", destination="dst", renumber=False)
cug_graph.from_cudf_edgelist(edges, source="src", destination="dst")
return cug_graph


Expand All @@ -162,7 +161,7 @@ def get_likes_graph() -> CUGGraph:

cug_graph = CUGGraph()
cug_graph.from_cudf_edgelist(
edges, source="src", destination="dst", edge_attr="likes", renumber=False
edges, source="src", destination="dst", edge_attr="likes"
)
return cug_graph

Expand Down
Binary file not shown.

0 comments on commit f045a05

Please sign in to comment.