Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
aMahanna committed Oct 17, 2023
1 parent f045a05 commit fd6736b
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 182 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ jobs:
- run:
name: Run black
command: black --check --verbose --diff --color --config=pyproject.toml ./adbcug_adapter ./tests/
- run:
name: Run flake8
command: flake8 ./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
name: Run mypy
command: mypy ./adbcug_adapter
- save_cache:
key: pip-and-local-cache
paths:
Expand Down
56 changes: 0 additions & 56 deletions .github/workflows/build.yml

This file was deleted.

72 changes: 22 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,8 @@ env:
PACKAGE_DIR: adbcug_adapter
TESTS_DIR: tests
jobs:
build:
runs-on: self-hosted
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
include:
- python: "3.7"
DB_NAME: "py37"

- python: "3.8"
DB_NAME: "py38"

- python: "3.9"
DB_NAME: "py39"
name: gpu
steps:
- uses: actions/checkout@v2
- name: Set up pip & install packages
run: |
source ~/anaconda3/etc/profile.d/conda.sh
conda activate ${{ matrix.python }}
python -m pip install --upgrade pip setuptools wheel
pip install .[dev]
- name: Run black
run: conda run -n ${{ matrix.python }} black --check --verbose --diff --color ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}}
- name: Run flake8
run: flake8 ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}}
- name: Run isort
run: isort --check --profile=black ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}}
- name: Run mypy
run: conda run -n ${{ matrix.python }} mypy ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}}
- name: Run pytest in conda env
run: conda run -n ${{ matrix.python }} pytest --dbName ${{ matrix.DB_NAME }} --cov=${{env.PACKAGE_DIR}} --cov-report xml --cov-report term-missing -v --color=yes --no-cov-on-fail --code-highlight=yes
- name: Publish to coveralls.io
if: matrix.python == '3.8'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: conda run -n ${{ matrix.python }} coveralls --service=github

release:
needs: build
runs-on: self-hosted
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
Expand All @@ -63,13 +21,27 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Conda Build
run: |
source ~/anaconda3/etc/profile.d/conda.sh
conda activate condabuild39
anaconda logout
conda config --set anaconda_upload yes
conda-build --token '${{ secrets.CONDA_TOKEN }}' --user arangodb .

- name: Install packages
run: pip install setuptools wheel twine setuptools-scm[toml]

- name: Remove (old) distribution
run: rm -rf dist

- name: Build distribution
run: python setup.py sdist bdist_wheel

- name: Publish to Test PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }}
run: twine upload --repository testpypi dist/* #--skip-existing

- name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: twine upload --repository pypi dist/* #--skip-existing

changelog:
needs: release
Expand Down
8 changes: 6 additions & 2 deletions adbcug_adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def cugraph_to_arangodb(
name, overwrite_graph, edge_definitions, orphan_collections
)

adb_v_cols: List[str] = adb_graph.vertex_collections() # type: ignore
adb_v_cols: List[str] = adb_graph.vertex_collections()
adb_e_cols: List[str] = [
c["edge_collection"] for c in adb_graph.edge_definitions() # type: ignore
]
Expand Down Expand Up @@ -389,7 +389,11 @@ def cugraph_to_arangodb(
bar_progress = get_bar_progress("(CUG → ADB): Edges", "#5E3108")
bar_progress_task = bar_progress.add_task("Edges", total=len(cug_edges))

cug_weights = cug_edges[edge_attr] if cug_graph.is_weighted() else None
cug_weights = (
cug_edges[edge_attr]
if cug_graph.is_weighted() and edge_attr is not None
else None
)

with Live(Group(bar_progress, spinner_progress)):
for i in range(len(cug_edges)):
Expand Down
26 changes: 5 additions & 21 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import logging
import os
import subprocess
from pathlib import Path
from typing import Any, List, Optional
from typing import Any, List

from adb_cloud_connector import get_temp_credentials
from arango import ArangoClient
from arango.database import StandardDatabase
from cudf import DataFrame
Expand All @@ -13,7 +11,7 @@

from adbcug_adapter import ADBCUG_Adapter
from adbcug_adapter.controller import ADBCUG_Controller
from adbcug_adapter.typings import CUGId, Json
from adbcug_adapter.typings import CUGId

PROJECT_DIR = Path(__file__).parent.parent

Expand Down Expand Up @@ -56,7 +54,6 @@ def pytest_configure(config: Any) -> None:
global adbcug_adapter, bipartite_adbcug_adapter, likes_adbcug_adapter
adbcug_adapter = ADBCUG_Adapter(db, logging_lvl=logging.DEBUG)
bipartite_adbcug_adapter = ADBCUG_Adapter(db, Bipartite_ADBCUG_Controller())
likes_adbcug_adapter = ADBCUG_Adapter(db, Likes_ADBCUG_Controller())

if db.has_graph("fraud-detection") is False:
arango_restore(con, "examples/data/fraud_dump")
Expand Down Expand Up @@ -138,6 +135,9 @@ def get_bipartite_graph() -> CUGGraph:


class Bipartite_ADBCUG_Controller(ADBCUG_Controller):
def _identify_cugraph_node(self, cug_node_id: CUGId, adb_v_cols: List[str]) -> str:
return str(cug_node_id).split("/")[0]

def _keyify_cugraph_node(self, cug_node_id: CUGId, col: str) -> str:
return self._string_to_arangodb_key_helper(str(cug_node_id).split("/")[1])

Expand All @@ -164,19 +164,3 @@ def get_likes_graph() -> CUGGraph:
edges, source="src", destination="dst", edge_attr="likes"
)
return cug_graph


class Likes_ADBCUG_Controller(ADBCUG_Controller):
def _identify_cugraph_edge(
self,
from_cug_node: Json,
to_cug_node: Json,
adb_e_cols: List[str],
weight: Optional[Any] = None,
) -> str:
if weight is True:
return "likes"
elif weight is False:
return "dislikes_intentional_typo_here"
else:
raise ValueError(f"Unrecognized 'weight' value: {weight}")
Loading

0 comments on commit fd6736b

Please sign in to comment.