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

Fixes some CI failures when serializing plugins #1721

Merged
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 4 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ jobs:
working-directory: examples/${{ matrix.example }}
run: |
pip install uv
uv venv
source .venv/bin/activate
uv venv $GITHUB_WORKSPACE/.venv
source $GITHUB_WORKSPACE/.venv/bin/activate
if [ -f requirements.in ]; then uv pip install -r requirements.in; fi
uv pip install "flytekit>=1.12.2" "numpy<2.0.0"
pip freeze
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
run: |
export FLYTE_PUSH_IMAGE_SPEC=${{ github.event_name != 'pull_request' }}
default_image=ghcr.io/flyteorg/flytecookbook:${{ matrix.example }}-${{ github.sha }}
source .venv/bin/activate
source $GITHUB_WORKSPACE/.venv/bin/activate
pyflyte \
--pkgs ${{ matrix.example }} package \
--image $default_image \
Expand Down Expand Up @@ -293,7 +293,7 @@ jobs:
pip install uv
uv venv
source .venv/bin/activate
uv pip install "flytekit>=1.12.2" flytekitplugins-deck-standard torch tabulate
uv pip install "flytekit>=1.12.2" flytekitplugins-deck-standard torch tabulate pyarrow
pip freeze
- name: Checkout flytesnacks
uses: actions/checkout@v3
Expand Down
7 changes: 5 additions & 2 deletions examples/data_types_and_io/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#syntax=docker/dockerfile:1.8
# ######################
# NOTE: For CI/CD only #
########################
Expand All @@ -17,8 +18,10 @@ ENV VENV /opt/venv
RUN python3 -m venv ${VENV}
ENV PATH="${VENV}/bin:$PATH"

RUN pip install flytekit pandas
RUN pip install torch --index-url https://download.pytorch.org/whl/cpu
RUN --mount=type=cache,sharing=locked,mode=0777,target=/root/.cache/pip,id=pip \
pip install flytekit pandas pyarrow
RUN --mount=type=cache,sharing=locked,mode=0777,target=/root/.cache/pip,id=pip \
eapolinario marked this conversation as resolved.
Show resolved Hide resolved
pip install torch --index-url https://download.pytorch.org/whl/cpu

# Copy the actual code
COPY . /root
Expand Down
1 change: 1 addition & 0 deletions examples/data_types_and_io/requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pandas
torch
tabulate
pyarrow
4 changes: 3 additions & 1 deletion examples/development_lifecycle/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#syntax=docker/dockerfile:1.8
# ######################
# NOTE: For CI/CD only #
########################
Expand All @@ -21,7 +22,8 @@ ENV PATH="${VENV}/bin:$PATH"

# Install Python dependencies
COPY requirements.in /root
RUN pip install -r /root/requirements.in
RUN --mount=type=cache,sharing=locked,mode=0777,target=/root/.cache/pip,id=pip \
pip install -r /root/requirements.in

# Copy the actual code
COPY . /root
Expand Down
1 change: 1 addition & 0 deletions examples/development_lifecycle/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ flytekitplugins-deck-standard
plotly
scikit-learn
tabulate
pyarrow
4 changes: 3 additions & 1 deletion examples/duckdb_plugin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#syntax=docker/dockerfile:1.8
FROM python:3.8-buster

WORKDIR /root
Expand Down Expand Up @@ -25,7 +26,8 @@ ENV PATH="${VENV}/bin:$PATH"

# Install Python dependencies
COPY requirements.in /root/
RUN pip install -r /root/requirements.in
RUN --mount=type=cache,sharing=locked,mode=0777,target=/root/.cache/pip,id=pip \
pip install -r /root/requirements.in

# Copy the actual code
COPY . /root/
Expand Down
1 change: 1 addition & 0 deletions examples/duckdb_plugin/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ wheel
matplotlib
flytekitplugins-deck-standard
flytekitplugins-duckdb
pyarrow
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,10 @@
import os

import lightning as L
from flytekit import ImageSpec, PodTemplate, Resources, task, workflow
from flytekit import ImageSpec, Resources, task, workflow
from flytekit.extras.accelerators import T4
from flytekit.types.directory import FlyteDirectory
from flytekitplugins.kfpytorch.task import Elastic
from kubernetes.client.models import (
V1Container,
V1EmptyDirVolumeSource,
V1PodSpec,
V1Volume,
V1VolumeMount,
)
from torch import nn, optim
from torch.utils.data import DataLoader
from torchvision.datasets import MNIST
Expand Down Expand Up @@ -69,19 +62,6 @@
# ```
# :::

# %% [markdown]
# We're also going to define a custom pod template that mounts a shared memory
# volume to `/dev/shm`. This is necessary for distributed data parallel (DDP)
# training so that state can be shared across workers.

# %%
container = V1Container(name=custom_image.name, volume_mounts=[V1VolumeMount(mount_path="/dev/shm", name="dshm")])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq: why do we remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With https://github.com/flyteorg/flytekit/pull/2543/files, a shared memory volume is injected by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thank you!

volume = V1Volume(name="dshm", empty_dir=V1EmptyDirVolumeSource(medium="Memory"))
custom_pod_template = PodTemplate(
primary_container_name=custom_image.name,
pod_spec=V1PodSpec(containers=[container], volumes=[volume]),
)

# %% [markdown]
# ## Define a `LightningModule`
#
Expand Down Expand Up @@ -175,7 +155,6 @@ def train_dataloader(self):
),
accelerator=T4,
requests=Resources(mem="32Gi", cpu="48", gpu="8", ephemeral_storage="100Gi"),
pod_template=custom_pod_template,
)
def train_model(dataloader_num_workers: int) -> FlyteDirectory:
"""Train an autoencoder model on the MNIST."""
Expand Down
Loading