-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PERIAN Job Platform Agent example (#1746)
Add PERIAN Job Platform example Signed-off-by: Omar Tarabai <[email protected]>
- Loading branch information
Showing
7 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
```{eval-rst} | ||
.. tags:: Cloud, GPU, Integration, Advanced | ||
``` | ||
|
||
(perian_agent)= | ||
|
||
# PERIAN Job Platform Agent | ||
|
||
The PERIAN Flyte Agent enables you to execute Flyte tasks on the [PERIAN Sky Platform](https://perian.io/). PERIAN allows the execution of any task on servers aggregated from multiple cloud providers. | ||
|
||
Example usage: | ||
|
||
```{auto-examples-toc} | ||
example | ||
``` | ||
|
||
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# %% [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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |