Skip to content

Commit

Permalink
matrix for ray and dagster versions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgafni committed Oct 21, 2024
1 parent 8f1de50 commit 38d92c7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:

jobs:
test:
name: Test Python ${{ matrix.py }} - KubeRay ${{ matrix.kuberay }}
name: Test Python ${{ matrix.py }} - Ray ${{ matrix.kuberay }} - Dagster ${{ matrix.dagster }} - KubeRay ${{ matrix.kuberay }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
Expand All @@ -31,6 +31,13 @@ jobs:
- "3.11"
- "3.10"
- "3.9"
ray:
- "2.37.0"
- "2.24.0"
- "2.12.0"
dagster:
- "1.8.12"
- "1.7.16"
kuberay:
- "1.1.0"
- "1.2.2"
Expand All @@ -57,10 +64,12 @@ jobs:
- name: Run tests
env:
PYTEST_KUBERAY_VERSIONS: "${{ matrix.kuberay }}"
PYTEST_RAY_VERSION: "${{ matrix.ray }}"
PYTEST_DAGSTER_VERSION: "${{ matrix.dagster }}"
run: uv run pytest -v .

lint:
name: lint ${{ matrix.py }} - ${{ matrix.os }}
name: Lint ${{ matrix.py }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
Expand Down
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ COPY --from=bitnami/kubectl:1.30.3 /opt/bitnami/kubectl/bin/kubectl /usr/local/b

# install uv (https://github.com/astral-sh/uv)
# docs for using uv with Docker: https://docs.astral.sh/uv/guides/integration/docker/
COPY --from=ghcr.io/astral-sh/uv:0.4.18 /uv /bin/uv
COPY --from=ghcr.io/astral-sh/uv:0.4.25 /uv /bin/uv

ENV UV_PROJECT_ENVIRONMENT=/usr/local/
ENV DAGSTER_HOME=/opt/dagster/dagster_home
Expand All @@ -27,7 +27,7 @@ WORKDIR /src
COPY pyproject.toml uv.lock ./

RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --all-extras --no-dev --no-install-project
uv sync --frozen --all-extras --no-dev --no-install-project --inexact

FROM base-prod AS base-dev

Expand All @@ -41,8 +41,18 @@ RUN --mount=type=cache,target=/cache/downloads \
curl https://nodejs.org/dist/v$NODE_VERSION/$NODE_PACKAGE.tar.gz -o /cache/downloads/$NODE_PACKAGE.tar.gz \
&& tar -xzC /opt/ -f /cache/downloads/$NODE_PACKAGE.tar.gz


RUN mkdir dagster_ray && touch dagster_ray/__init__.py && touch README.md
COPY dagster_ray/_version.py dagster_ray/_version.py

# Install specific Dagster and Ray versions (for integration tests)
ARG RAY_VERSION=2.35.0
ARG DAGSTER_VERSION=1.8.12
RUN --mount=type=cache,target=/root/.cache/uv \
uv add --no-sync "ray[all]==$RAY_VERSION" "dagster==$DAGSTER_VERSION"

RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --all-extras --no-install-project
uv sync --frozen --all-extras --no-install-project --inexact

# -------------------------------------------------------------
FROM base-${BUILD_DEPENDENCIES} AS final
Expand All @@ -51,4 +61,4 @@ FROM base-${BUILD_DEPENDENCIES} AS final
COPY . .

# finally install all our code
RUN uv sync --frozen --all-extras
RUN uv sync --frozen --all-extras --inexact
15 changes: 14 additions & 1 deletion tests/kuberay/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def kuberay_helm_repo():

@pytest.fixture(scope="session")
def dagster_ray_image():
import dagster
import ray

"""
Either returns the image name from the environment variable PYTEST_DAGSTER_RAY_IMAGE
or builds the image and returns it
Expand All @@ -36,7 +39,11 @@ def dagster_ray_image():
if PYTEST_DAGSTER_RAY_IMAGE is None:
# build the local image
python_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
image = f"local/dagster-ray:py-{python_version}"
ray_version = os.getenv("PYTEST_RAY_VERSION") or ray.__version__
dagster_version = os.getenv("PYTEST_DAGSTER_VERSION") or dagster.__version__

image = f"local/dagster-ray:py-{python_version}-{ray_version}-{dagster_version}"

subprocess.run(
[
"docker",
Expand All @@ -47,6 +54,10 @@ def dagster_ray_image():
"BUILD_DEPENDENCIES=dev",
"--build-arg",
f"PYTHON_VERSION={python_version}",
"--build-arg",
f"RAY_VERSION={ray_version}",
"--build-arg",
f"DAGSTER_VERSION={dagster_version}",
"-t",
image,
str(ROOT_DIR),
Expand Down Expand Up @@ -155,6 +166,8 @@ def k8s_with_raycluster(

client.create(
body={
"Kind": "RayCluster",
"apiVersion": "ray.io/v1",
"metadata": {"name": PERSISTENT_RAY_CLUSTER_NAME},
"spec": {
"headGroupSpec": head_group_spec,
Expand Down

0 comments on commit 38d92c7

Please sign in to comment.