Skip to content

Commit

Permalink
Remove invalid eager workflows examples (#1784)
Browse files Browse the repository at this point in the history
* Remove invalid eager workflows examples

Signed-off-by: Eduardo Apolinario <[email protected]>

* Use actions/cache@v4

Signed-off-by: Eduardo Apolinario <[email protected]>

* Remove neverett from codeowners

Signed-off-by: Eduardo Apolinario <[email protected]>

* Fix lint warnings

Signed-off-by: Eduardo Apolinario <[email protected]>

* Use clear-action-cache

Signed-off-by: Eduardo Apolinario <[email protected]>

* Use correct path to action

Signed-off-by: Eduardo Apolinario <[email protected]>

* Use valid image registry in memray_example.py

Signed-off-by: Eduardo Apolinario <[email protected]>

* Use uv in neptune image

Signed-off-by: Eduardo Apolinario <[email protected]>

---------

Signed-off-by: Eduardo Apolinario <[email protected]>
Co-authored-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario and eapolinario authored Mar 12, 2025
1 parent 257579e commit 40078c3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 46 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
Expand Down Expand Up @@ -71,13 +71,14 @@ jobs:
example: "${{ fromJson(needs.list_examples.outputs.packages) }}"
steps:
- uses: actions/checkout@v4
- uses: insightsengineering/disk-space-reclaimer@v1
- name: 'Clear action cache'
uses: ./.github/actions/clear-action-cache
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
Expand Down Expand Up @@ -262,14 +263,15 @@ jobs:
FLYTESNACKS_VERSION: ""
timeout-minutes: 30
steps:
- uses: insightsengineering/disk-space-reclaimer@v1
- name: Set latest Flytesnacks release
if: ${{ env.FLYTESNACKS_VERSION == '' }}
run: |
FLYTESNACKS_VERSION="$(curl --silent https://api.github.com/repos/flyteorg/flytesnacks/releases/latest | jq -r .tag_name)"
echo "FLYTESNACKS_VERSION=${FLYTESNACKS_VERSION}" >> ${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v3
- name: 'Clear action cache'
uses: ./.github/actions/clear-action-cache
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence.
* @neverett @ppiegaze
* @ppiegaze
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from flytekit import task, workflow
from flytekit.experimental import eager
from flytekit import eager, task, workflow


# Example 1
Expand Down Expand Up @@ -99,7 +98,7 @@ async def nested_eager_workflow(x: int) -> int:

# Example 7
# Catching exceptions
from flytekit.experimental import EagerException
from flytekit.exceptions.eager import EagerException


@task
Expand All @@ -115,31 +114,3 @@ async def eager_workflow_with_exception(x: int) -> int:
return await raises_exc(x=x)
except EagerException:
return -1


# Execute eager workflows locally by calling them
# like a regular `async` function

if __name__ == "__main__":
result = asyncio.run(simple_eager_workflow(x=5))
print(f"Result: {result}") # "Result: 12"


# Sandbox Flyte cluster execution
# See docs for full steps
from flytekit.configuration import Config
from flytekit.remote import FlyteRemote


@eager(
remote=FlyteRemote(
config=Config.for_sandbox(),
default_project="flytesnacks",
default_domain="development",
)
)
async def eager_workflow_sandbox(x: int) -> int:
out = await add_one(x=x)
if out < 0:
return -1
return await double(x=out)
7 changes: 4 additions & 3 deletions examples/memray_plugin/memray_plugin/memray_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
# Memray tracks and reports memory allocations, both in python code and in compiled extension modules.
# This Memray Profiling plugin enables memory tracking on the Flyte task level and renders a memgraph profiling graph on Flyte Deck.
# %%
from flytekit import workflow, task, ImageSpec
from flytekitplugins.memray import memray_profiling
import time

from flytekit import ImageSpec, task, workflow
from flytekitplugins.memray import memray_profiling

# %% [markdown]
# First, we use `ImageSpec` to construct a container that contains the dependencies for the
# tasks, we want to profile:
# %%
image = ImageSpec(
name="memray_demo",
packages=["flytekitplugins_memray"],
registry="<your_cr_registry>",
registry="ghcr.io/flyteorg", # Use your image registry
)


Expand Down
7 changes: 1 addition & 6 deletions examples/neptune_plugin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ FROM python:3.11-slim-bookworm
LABEL org.opencontainers.image.source https://github.com/flyteorg/flytesnacks

WORKDIR /root
ENV VENV /opt/venv
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONPATH /root

# Virtual environment
RUN python3 -m venv ${VENV}
ENV PATH="${VENV}/bin:$PATH"

# Install Python dependencies
COPY requirements.in /root
RUN pip install --no-cache-dir -r /root/requirements.in
RUN pip install uv && uv pip install --system --no-cache-dir -r /root/requirements.in

# Copy the actual code
COPY . /root
Expand Down
2 changes: 1 addition & 1 deletion examples/ray_plugin/ray_plugin/ray_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
)

import ray
from flytekit.models.task import K8sPod
from flytekitplugins.ray import HeadNodeConfig, RayJobConfig, WorkerNodeConfig


Expand Down Expand Up @@ -106,6 +105,7 @@ def ray_task(n: int) -> typing.List[int]:
ttl_seconds_after_finished=3600,
)


# Lastly, define a workflow to call the Ray task.
# %%
@workflow
Expand Down

0 comments on commit 40078c3

Please sign in to comment.