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

Stable serialise #1683

Merged
merged 28 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
26677df
serialise one node graph with proto and prost
fabianmurariu Jul 2, 2024
ae69f79
add minimal support for properties
fabianmurariu Jul 2, 2024
5f52f27
add better support for properties and start using ids
fabianmurariu Jul 3, 2024
3af743e
can encode props and encode and decode edges
fabianmurariu Jul 3, 2024
c6326a3
added graph const and temporal properties
fabianmurariu Jul 4, 2024
195bcf2
add test for edge properties
fabianmurariu Jul 4, 2024
edf50b4
add test for edge deletions
fabianmurariu Jul 4, 2024
be1ae08
arrange dependencies
fabianmurariu Jul 4, 2024
09af907
add string interning and add protoc to the build
fabianmurariu Jul 4, 2024
92f495d
add protoc to rust doctest
fabianmurariu Jul 4, 2024
d8a397a
try adding github token to binstall and protoc install
fabianmurariu Jul 4, 2024
390e96e
add protoc to benchmarks
fabianmurariu Jul 4, 2024
cab994a
attempt to fix the github token issues with protoc
fabianmurariu Jul 4, 2024
c68de7f
more protoc
fabianmurariu Jul 4, 2024
11ae62f
Graph and Persistend graph now work with pickle and the format is stable
fabianmurariu Jul 5, 2024
8023b7a
move protobuf in a separate feature
fabianmurariu Jul 5, 2024
2feaca4
fix the python workflow
fabianmurariu Jul 5, 2024
cc3762c
fmt
fabianmurariu Jul 5, 2024
e9bec36
add more protoc in yml
fabianmurariu Jul 5, 2024
085c78b
attempt to fix the disk storage
fabianmurariu Jul 5, 2024
86ca3a7
fix python failing
fabianmurariu Jul 5, 2024
19d1d9b
fix graphql lib import issues
fabianmurariu Jul 5, 2024
1fcbc9c
change the proto format so it can be easily extended
fabianmurariu Jul 8, 2024
f56e564
try ubuntu 20.04 to avoid 143 error
fabianmurariu Jul 8, 2024
6d7d205
some changes as per review
fabianmurariu Jul 9, 2024
7a35003
refactor StableDecode trait
fabianmurariu Jul 9, 2024
bcdb881
use assert_graph_equals
fabianmurariu Jul 9, 2024
832059c
fix compile issues
fabianmurariu Jul 9, 2024
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
12 changes: 12 additions & 0 deletions .github/workflows/_release_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
Expand Down Expand Up @@ -121,6 +125,10 @@ jobs:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
ref: ${{ inputs.base }}
Expand Down Expand Up @@ -157,6 +165,10 @@ jobs:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/_release_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- run: |
git config --global user.email "[email protected]"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
name: Checkout
- name: Update Rust
run: rustup update
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test_python_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
toolchain: 1.77.0
override: true
components: rustfmt, clippy
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: webfactory/[email protected]
name: Load raphtory-disk_graph key
with:
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/test_rust_disk_storage_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ jobs:
runs-on: '${{ matrix.os }}'
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
RUST_BACKTRACE: 1
strategy:
matrix:
include:
- os: macos-latest
- os: ubuntu-latest
- os: ubuntu-20.04
- os: windows-latest
steps:
- uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -36,7 +37,7 @@ jobs:
override: true
components: rustfmt, clippy
- name: Free up space (ubuntu)
if: matrix.os == 'ubuntu-latest'
if: "contains(matrix.os, 'ubuntu')"
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
Expand All @@ -52,10 +53,12 @@ jobs:
name: Cargo cache
with:
cache-all-crates: true
- name: Install bininstall
uses: cargo-bins/cargo-binstall@main
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install nextest
run: cargo binstall -y --force cargo-nextest
uses: taiki-e/install-action@nextest
- name: Activate pometry-storage in Cargo.toml
run: make pull-storage
- name: Run all Tests (disk_graph)
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/test_rust_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ jobs:
runs-on: '${{ matrix.os }}'
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
RUST_BACKTRACE: 1
strategy:
matrix:
include:
- os: macos-latest
- os: ubuntu-latest
- os: ubuntu-20.04
- os: windows-latest
steps:
- uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -36,12 +37,16 @@ jobs:
override: true
components: rustfmt, clippy
- name: Free up space (ubuntu)
if: matrix.os == 'ubuntu-latest'
if: "contains(matrix.os, 'ubuntu')"
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: webfactory/[email protected]
name: Load pometry-storage key
with:
Expand All @@ -52,10 +57,8 @@ jobs:
name: Cargo cache
with:
cache-all-crates: true
- name: Install bininstall
uses: cargo-bins/cargo-binstall@main
- name: Install nextest
run: cargo binstall -y --force cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run all Tests (no disk_graph)
env:
RUSTFLAGS: -Awarnings
Expand All @@ -80,6 +83,10 @@ jobs:
toolchain: 1.77.0
override: true
components: rustfmt, clippy
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
name: Cargo cache
with:
Expand Down
79 changes: 79 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ url = "2.2"
base64-compat = { package = "base64-compat", version = "1.0.0" }
time = "0.3.36"

prost = "0.12"
prost-types = "0.12"
bytes = "1.6.0"
prost-build = "0.12"

lazy_static = "1.4.0"
pest = "2.7.8"
pest_derive = "2.7.8"
Expand Down
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ crate-type = ["cdylib"]

[dependencies]
pyo3 = { workspace = true }
raphtory_core = { path = "../raphtory", version = "0.9.3", features = ["python", "search", "vectors"], package = "raphtory" }
raphtory_core = { path = "../raphtory", version = "0.9.3", features = ["python", "search", "vectors", "proto"], package = "raphtory" }
raphtory-graphql = { path = "../raphtory-graphql", version = "0.9.3",features = ["python"] }
serde_json = { workspace = true }
reqwest = { workspace = true }
Expand Down
24 changes: 24 additions & 0 deletions python/tests/test_graphdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import os
import shutil
import numpy as np
import pickle

base_dir = Path(__file__).parent
edges = [(1, 1, 2), (2, 1, 3), (-1, 2, 1), (0, 1, 1), (7, 3, 2), (1, 1, 1)]
Expand Down Expand Up @@ -59,6 +60,29 @@ def test_graph_len_edge_len():
assert g.count_edges() == 5


def test_graph_pickle():
g = create_graph()
# pickle graph
with tempfile.TemporaryDirectory() as tmpdirname:
pickle.dump(g, open(tmpdirname + "/graph.p", "wb"))
# unpickle graph
g2 = pickle.load(open(tmpdirname + "/graph.p", "rb"))

assert g2.count_nodes() == 3
assert g2.count_edges() == 5


def test_persistent_graph_pickle():
g = create_graph_with_deletions()
# pickle graph
with tempfile.TemporaryDirectory() as tmpdirname:
pickle.dump(g, open(tmpdirname + "/graph.p", "wb"))
# unpickle graph
g2 = pickle.load(open(tmpdirname + "/graph.p", "rb"))

assert g2.count_nodes() == 3
assert g2.count_edges() == 5

def test_id_iterable():
g = create_graph()

Expand Down
6 changes: 4 additions & 2 deletions raphtory-graphql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ mod graphql_test {
};
use serde_json::json;
use std::collections::{HashMap, HashSet};
use tempfile::{tempdir, TempDir};
use tempfile::tempdir;

#[cfg(feature = "storage")]
use tempfile::TempDir;

#[tokio::test]
async fn search_for_gandalf_query() {
Expand Down Expand Up @@ -266,7 +269,6 @@ mod graphql_test {

let req = Request::new(prop_has_key_filter);
let res = schema.execute(req).await;
let data = res.data.into_json().unwrap();
let expected = json!({
"graph": {
"properties": {
Expand Down
Loading
Loading