-
Notifications
You must be signed in to change notification settings - Fork 122
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
MemVerge MMCloud Agent #1128
Merged
Merged
MemVerge MMCloud Agent #1128
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c73ba4a
Add MMCloud plugin to Integrations
edwinyyyu 3cce078
Remove default image from README and example
edwinyyyu 627afe3
Fix end of requirements.in
edwinyyyu c92b593
update requirement.txt for mmcloud_plugin
helenzhangyc 3842ea7
Merge branch 'master' into master
helenzhangyc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,27 @@ | ||
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 | ||
|
||
WORKDIR /root | ||
|
||
ENV VENV /opt/venv | ||
# Virtual environment | ||
RUN python3 -m venv ${VENV} | ||
ENV PATH="${VENV}/bin:$PATH" | ||
|
||
# Install Python dependencies | ||
COPY requirements.txt /root | ||
RUN pip install -r /root/requirements.txt | ||
|
||
# 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,80 @@ | ||
# Memory Machine Cloud | ||
|
||
```{eval-rst} | ||
.. tags:: AWS, GCP, AliCloud, Integration, Advanced | ||
``` | ||
|
||
[MemVerge](https://memverge.com/) [Memory Machine Cloud](https://www.mmcloud.io/) (MMCloud)—available on AWS, GCP, and AliCloud—empowers users to continuously optimize cloud resources during runtime, safely execute stateful tasks on spot instances, and monitor resource usage in real time. These capabilities make it an excellent fit for long-running batch workloads. | ||
|
||
Flyte can be integrated with MMCloud, allowing you to execute Flyte tasks using MMCloud. | ||
|
||
## Installation | ||
|
||
To install the plugin, run the following command: | ||
|
||
```{eval-rst} | ||
.. prompt:: bash | ||
|
||
pip install flytekitplugins-mmcloud | ||
``` | ||
|
||
To get started with MMCloud, refer to the [MMCloud User Guide](https://docs.memverge.com/mmce/current/userguide/olh/index.html). | ||
|
||
## Configuring the backend to get MMCloud working | ||
|
||
The MMCloud plugin is [enabled in FlytePropeller's configuration](https://docs.flyte.org/en/latest/deployment/plugins/memverge/mmcloud.html). | ||
|
||
## Getting Started | ||
|
||
This plugin allows executing `PythonFunctionTask` using MMCloud without changing any function code. | ||
|
||
```{eval-rst} | ||
.. testcode:: awsbatch-quickstart | ||
from flytekitplugins.mmcloud import MMCloudConfig | ||
|
||
@task(task_config=MMCloudConfig()) | ||
def to_str(i: int) -> str: | ||
return str(i) | ||
``` | ||
|
||
[Resource](https://docs.flyte.org/projects/cookbook/en/latest/auto_examples/productionizing/customizing_resources.html) (cpu and mem) requests and limits, [container](https://docs.flyte.org/projects/cookbook/en/latest/auto_examples/customizing_dependencies/multi_images.html) images, and [environment](https://docs.flyte.org/projects/flytekit/en/latest/generated/flytekit.task.html) variable specifications are supported. | ||
|
||
[ImageSpec](https://docs.flyte.org/projects/cookbook/en/latest/auto_examples/customizing_dependencies/image_spec.html) may be used to define images to run tasks. | ||
|
||
### Credentials | ||
|
||
The following [secrets](https://docs.flyte.org/projects/cookbook/en/latest/auto_examples/productionizing/use_secrets.html) are required to be defined for the agent server: | ||
* `mmc_address`: MMCloud OpCenter address | ||
* `mmc_username`: MMCloud OpCenter username | ||
* `mmc_password`: MMCloud OpCenter password | ||
|
||
### Defaults | ||
|
||
Compute resources: | ||
* If only requests are specified, there are no limits. | ||
* If only limits are specified, the requests are equal to the limits. | ||
* If neither resource requests nor limits are specified, the default requests used for job submission are `cpu="1"` and `mem="1Gi"`, and there are no limits. | ||
|
||
### Agent Image | ||
|
||
Install `flytekitplugins-mmcloud` in the agent image. | ||
|
||
A `float` binary (obtainable via the OpCenter) is required. Copy it to the agent image `PATH`. | ||
|
||
Sample `Dockerfile` for building an agent image: | ||
```dockerfile | ||
FROM python:3.11-slim-bookworm | ||
|
||
WORKDIR /root | ||
ENV PYTHONPATH /root | ||
|
||
# flytekit will autoload the agent if package is installed. | ||
RUN pip install flytekitplugins-mmcloud | ||
COPY float /usr/local/bin/float | ||
|
||
CMD pyflyte serve --port 8000 | ||
``` | ||
|
||
```{auto-examples-toc} | ||
example | ||
``` |
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,42 @@ | ||
# %% [markdown] | ||
# # Memory Machine Cloud | ||
# | ||
# This example shows how to use the MMCloud plugin to execute tasks on MemVerge Memory Machine Cloud. | ||
|
||
# %% | ||
from flytekit import Resources, task, workflow | ||
from flytekitplugins.mmcloud import MMCloudConfig | ||
|
||
# %% [markdown] | ||
# `MMCloudConfig` configures `MMCloudTask`. Tasks specified with `MMCloudConfig` will be executed using MMCloud. Tasks will be executed with requests `cpu="1"` and `mem="1Gi"` by default. | ||
|
||
# %% | ||
@task(task_config=MMCloudConfig()) | ||
def to_str(i: int) -> str: | ||
return str(i) | ||
|
||
|
||
@task(task_config=MMCloudConfig()) | ||
def to_int(s: str) -> int: | ||
return int(s) | ||
|
||
|
||
# %% [markdown] | ||
# [Resource](https://docs.flyte.org/projects/cookbook/en/latest/auto_examples/productionizing/customizing_resources.html) (cpu and mem) requests and limits, [container](https://docs.flyte.org/projects/cookbook/en/latest/auto_examples/customizing_dependencies/multi_images.html) images, and [environment](https://docs.flyte.org/projects/flytekit/en/latest/generated/flytekit.task.html) variable specifications are supported. | ||
|
||
# %% | ||
@task( | ||
task_config=MMCloudConfig(submit_extra="--migratePolicy [enable=true]"), | ||
requests=Resources(cpu="1", mem="1Gi"), | ||
limits=Resources(cpu="2", mem="4Gi"), | ||
environment={"KEY": "value"}, | ||
) | ||
def concatenate_str(s1: str, s2: str) -> str: | ||
return s1 + s2 | ||
|
||
|
||
@workflow | ||
def concatenate_int_wf(i1: int, i2: int) -> int: | ||
i1_str = to_str(i=i1) | ||
i2_str = to_str(i=i2) | ||
return to_int(s=concatenate_str(s1=i1_str, s2=i2_str)) |
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,2 @@ | ||
flytekitplugins-envd | ||
flytekitplugins-mmcloud |
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to run
pip-compile
(see here) to make surerequirements.txt
is compiled (currently it's an empty file)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an error
No matching distribution found for flytekitplugins-mmcloud
when runningpip-compile
on this. I think it's becauseflytekitplugins-mmcloud
has not been published yet?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to wait for
flytekitplugins-mmcloud
to be published in the next flytekit release to merge the flytesnacks docs