Skip to content
Merged
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
14 changes: 8 additions & 6 deletions .github/workflows/_release_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ on:
type: boolean
default: false
python:
type: boolean
description: If selected will build the python version of the image
default: false
type: string
description: If set, will build the python image using this as the tag for the base python image, e.g. '3.14.2-slim-trixie'
workflow_call:
inputs: *inputs


permissions:
contents: read

Expand Down Expand Up @@ -52,10 +50,12 @@ jobs:

- name: Set dockerfile path and cache image
run: |
if [ "${{ inputs.python }}" = "true" ]; then
if [ -n "${{ inputs.python }}" ]; then
echo "Building Python image with base python:${{ inputs.python }}"
echo "DOCKERFILE_PATH=python.Dockerfile" >> $GITHUB_ENV
echo "CACHE_IMAGE=${{ env.REGISTRY_IMAGE }}:buildcache-python-${{ env.PLATFORM_PAIR }}" >> $GITHUB_ENV
else
echo "Building Rust image"
echo "DOCKERFILE_PATH=Dockerfile" >> $GITHUB_ENV
echo "CACHE_IMAGE=${{ env.REGISTRY_IMAGE }}:buildcache-rust-${{ env.PLATFORM_PAIR }}" >> $GITHUB_ENV
fi
Expand All @@ -81,7 +81,9 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
build-args: RUST_VERSION=${{ env.RUST_VERSION }}
build-args: |
RUST_VERSION=${{ env.RUST_VERSION }}
BASE_PYTHON_IMAGE_TAG=${{ inputs.python }}
file: ${{ env.DOCKERFILE_PATH }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/release_auto.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
name: 🚀🦀🐍🐳🐙 Publish all packages to crates.io, PyPi, Docker Hub & Github

env:
PYTHON_VERSION: 3.14.2
DEBIAN_VERSION: trixie

on:
workflow_dispatch:
inputs:
Expand All @@ -15,7 +20,7 @@ jobs:
read-raphtory-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -62,7 +67,8 @@ jobs:
base: ${{ inputs.base }}
dry_run: ${{ inputs.dry_run == true }}
tag: |
${{ needs.read-raphtory-version.outputs.version }}-python${{ env.PYTHON_VERSION }}-${{ env.DEBIAN_VERSION }}
${{ needs.read-raphtory-version.outputs.version }}-python
latest-python
python: true
python: ${{ env.PYTHON_VERSION }}-slim-${{ env.DEBIAN_VERSION }}
secrets: inherit
12 changes: 6 additions & 6 deletions python.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
ARG PYTHON_VERSION=3.13.5
ARG RUST_VERSION=1.86.0
ARG BASE_PYTHON_IMAGE_TAG

FROM rust:${RUST_VERSION} AS build
ARG PYTHON_VERSION
ARG BASE_PYTHON_IMAGE_TAG
WORKDIR /app
ENV HOME=/root
ENV PYENV_ROOT=$HOME/.pyenv
ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN apt-get update && apt-get install -y protobuf-compiler
RUN curl -fsSL https://pyenv.run | bash
RUN pyenv install ${PYTHON_VERSION}
RUN pyenv global ${PYTHON_VERSION}
RUN PYTHON_VERSION=$(echo ${BASE_PYTHON_IMAGE_TAG} | cut -d'-' -f1) && \
pyenv install ${PYTHON_VERSION} && \
pyenv global ${PYTHON_VERSION}
RUN pip install maturin==1.8.3 patchelf==0.17.2.2
COPY . .
RUN cd python && maturin build --release

FROM python:${PYTHON_VERSION}-slim
ARG PYTHON_VERSION
FROM python:${BASE_PYTHON_IMAGE_TAG}

Check warning on line 19 in python.Dockerfile

View workflow job for this annotation

GitHub Actions / build (linux/amd64)

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG python:${BASE_PYTHON_IMAGE_TAG} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 19 in python.Dockerfile

View workflow job for this annotation

GitHub Actions / build (linux/arm64)

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG python:${BASE_PYTHON_IMAGE_TAG} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/
WORKDIR /var/lib/raphtory
COPY --from=build /app/target/wheels/*.whl /
RUN pip install --no-cache-dir /*.whl && rm /*.whl
Expand Down
10 changes: 9 additions & 1 deletion raphtory-graphql/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub(crate) fn get_relative_path(
#[derive(Clone)]
pub struct Data {
pub(crate) work_dir: PathBuf,
cache: Cache<PathBuf, GraphWithVectors>,
pub(crate) cache: Cache<PathBuf, GraphWithVectors>,
pub(crate) create_index: bool,
pub(crate) embedding_conf: Option<EmbeddingConf>,
}
Expand Down Expand Up @@ -414,6 +414,14 @@ pub(crate) mod data_tests {
sleep(Duration::from_secs(3)).await;
assert!(!data.cache.contains_key(Path::new("test_g")));
assert!(!data.cache.contains_key(Path::new("test_g2")));
// FIXME: this test is not doing anything because calling cache.contains_key() runs
// any pending evictions. To actually test it we need this assertion:
// assert_eq!(data.cache.entry_count(), 0);
// Which currently does not work because the server task to trigger evictions is not running
// in this context. The problem is if we do run it by creating a server and calling
// server.start() the server gets consumed and we loose access to the cache to be able to run
// the check. If rework the server implementation and this becomes feasible we should change
// this test
}

#[tokio::test]
Expand Down
10 changes: 10 additions & 0 deletions raphtory-graphql/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ impl GraphServer {
self.data.vectorise_all_graphs_that_are_not().await?;
let work_dir = self.data.work_dir.clone();

// Otherwise evictions are only triggered when the cache is actively touched
let cache_clone = self.data.cache.clone();
tokio::spawn(async move {
let mut interval = tokio::time::interval(std::time::Duration::from_secs(1));
loop {
interval.tick().await;
cache_clone.run_pending_tasks().await;
}
});

// it is important that this runs after algorithms have been pushed to PLUGIN_ALGOS static variable
let app = self
.generate_endpoint(tp.clone().map(|tp| tp.tracer(tracer_name)))
Expand Down