Skip to content

Commit

Permalink
Add PERIAN Job Platform example
Browse files Browse the repository at this point in the history
Signed-off-by: Omar Tarabai <[email protected]>
  • Loading branch information
otarabai committed Oct 9, 2024
1 parent 846ad8b commit 7866472
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ orchestrated by Flyte itself, within its provisioned Kubernetes clusters.
- Execute tasks using the MemVerge Memory Machine Cloud agent.
* - {doc}`OpenAI Batch </auto_examples/openai_batch_agent/index>`
- Submit requests for asynchronous batch processing on OpenAI.
* - {doc}`PERIAN Agent </auto_examples/perian_agent/index>`
- Execute tasks on PERIAN Job Platform.
* - {doc}`SageMaker Inference </auto_examples/sagemaker_inference_agent/index>`
- Deploy models and create, as well as trigger inference endpoints on SageMaker.
* - {doc}`Sensor </auto_examples/sensor/index>`
Expand Down
31 changes: 31 additions & 0 deletions examples/perian_agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM python:3.8-slim-buster
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

# This is necessary for opencv to work
RUN apt-get update && apt-get install -y libsm6 libxext6 libxrender-dev ffmpeg build-essential curl

WORKDIR /root

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

# Install Python dependencies
COPY requirements.in /root
RUN pip install -r /root/requirements.in
RUN pip freeze

# Copy the actual code
COPY . /root

# This tag is supplied by the build script and will be used to determine the version
# when registering tasks, workflows, and launch plans
ARG tag
ENV FLYTE_INTERNAL_IMAGE $tag
21 changes: 21 additions & 0 deletions examples/perian_agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# PERIAN Job Platform Agent

Flyte Agent plugin for executing Flyte tasks on PERIAN Job Platform (perian.io). PERIAN allows the serverless execution of any task on servers aggregated from multiple cloud providers.

Example usage:

```{auto-examples-toc}
@task(container_image=image_spec,
task_config=PerianConfig(
accelerators=1,
accelerator_type="A100",
))
def perian_hello(name: str) -> str:
return f"hello {name}!"
```

To get started with PERIAN, see the [PERIAN documentation](https://perian.io/docs/overview) and the [PERIAN Flyte Agent documentation](https://perian.io/docs/flyte-getting-started).

## Agent Setup

Consult the [PERIAN Flyte Agent setup guide](https://perian.io/docs/flyte-setup-guide).
Empty file.
37 changes: 37 additions & 0 deletions examples/perian_agent/perian_agent/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# %% [markdown]
# (example)=
# # PERIAN agent example usage
#
# This example shows how to use the PERIAN agent to execute tasks on PERIAN Job Platform.

# %%
from flytekit import ImageSpec, task, workflow
from flytekitplugins.perian_job import PerianConfig

image_spec = ImageSpec(
name="flyte-test",
registry="my-registry",
python_version="3.11",
apt_packages=["wget", "curl", "git"],
packages=[
"flytekitplugins-perian-job",
],
)


# %% [markdown]
# `PerianConfig` configures `PerianTask`. Tasks specified with `PerianConfig` will be executed on PERIAN Job Platform.

# %%
@task(container_image=image_spec,
task_config=PerianConfig(
accelerators=1,
accelerator_type="A100",
))
def perian_hello(name: str) -> str:
return f"hello {name}!"


@workflow
def my_wf(name: str = "world") -> str:
return perian_hello(name=name)
5 changes: 5 additions & 0 deletions examples/perian_agent/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
flytekit>=1.7.0
wheel
matplotlib
flytekitplugins-deck-standard
flytekitplugins-perian-job

0 comments on commit 7866472

Please sign in to comment.