Skip to content

Commit

Permalink
CircleCI setup (#28)
Browse files Browse the repository at this point in the history
* Add .circleci/config.yml

* Add .circleci/config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* lock lint packages

* fix black

* Update config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* bump

* Update conftest.py

* Update adapter.py
  • Loading branch information
aMahanna authored Oct 17, 2023
1 parent 86243ff commit 1887ddc
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 32 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
1 change: 0 additions & 1 deletion adbcug_adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def arangodb_to_cugraph(
source="src",
destination="dst",
edge_attr=edge_attr,
renumber=False,
)

logger.info(f"Created cuGraph '{name}' Graph")
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
],
extras_require={
"dev": [
"black",
"flake8>=3.8.0",
"isort>=5.0.0",
"mypy>=0.790",
"black==23.3.0",
"flake8==6.0.0",
"isort==5.12.0",
"mypy==1.4.1",
"pytest>=6.0.0",
"pytest-cov>=2.0.0",
"coveralls>=3.3.1",
Expand Down
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
1 change: 0 additions & 1 deletion tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ def assert_arangodb_data(


def assert_cugraph_data(cug_g: CUGMultiGraph, metagraph: ADBMetagraph) -> None:

adb_edge: Json
df = cug_g.to_pandas_edgelist()
for col, atribs in metagraph["edgeCollections"].items():
Expand Down
Binary file not shown.

0 comments on commit 1887ddc

Please sign in to comment.