MemVerge Flyte plugin
Project description
Flytekit Memory Machine Cloud Plugin
Flyte Connector plugin to allow executing Flyte tasks using MemVerge Memory Machine Cloud.
To install the plugin, run the following command:
pip install flytekitplugins-mmcloud
To get started with MMCloud, refer to the MMCloud User Guide.
Getting Started
This plugin allows executing PythonFunctionTask using MMCloud without changing any function code.
Resource (cpu and mem) requests and limits, container images, and environment variable specifications are supported.
ImageSpec may be used to define images to run tasks.
Credentials
The following secrets are required to be defined for the connector server:
mmc_address: MMCloud OpCenter addressmmc_username: MMCloud OpCenter usernamemmc_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"andmem="1Gi", and there are no limits.
Example
example.py workflow example:
import pandas as pd
from flytekit import ImageSpec, Resources, task, workflow
from sklearn.datasets import load_wine
from sklearn.linear_model import LogisticRegression
from flytekitplugins.mmcloud import MMCloudConfig
image_spec = ImageSpec(packages=["scikit-learn"], registry="docker.io/memverge")
@task
def get_data() -> pd.DataFrame:
"""Get the wine dataset."""
return load_wine(as_frame=True).frame
@task(task_config=MMCloudConfig(), container_image=image_spec) # Task will be submitted as MMCloud job
def process_data(data: pd.DataFrame) -> pd.DataFrame:
"""Simplify the task from a 3-class to a binary classification problem."""
return data.assign(target=lambda x: x["target"].where(x["target"] == 0, 1))
@task(
task_config=MMCloudConfig(submit_extra="--migratePolicy [enable=true]"),
requests=Resources(cpu="1", mem="1Gi"),
limits=Resources(cpu="2", mem="4Gi"),
container_image=image_spec,
environment={"KEY": "value"},
)
def train_model(data: pd.DataFrame, hyperparameters: dict) -> LogisticRegression:
"""Train a model on the wine dataset."""
features = data.drop("target", axis="columns")
target = data["target"]
return LogisticRegression(max_iter=3000, **hyperparameters).fit(features, target)
@workflow
def training_workflow(hyperparameters: dict) -> LogisticRegression:
"""Put all of the steps together into a single workflow."""
data = get_data()
processed_data = process_data(data=data)
return train_model(
data=processed_data,
hyperparameters=hyperparameters,
)
Connector Image
Install flytekitplugins-mmcloud in the connector image.
A float binary (obtainable via the OpCenter) is required. Copy it to the connector image PATH.
Sample Dockerfile for building an connector image:
FROM python:3.11-slim-bookworm
WORKDIR /root
ENV PYTHONPATH /root
# flytekit will autoload the connector if package is installed.
RUN pip install flytekitplugins-mmcloud
COPY float /usr/local/bin/float
CMD pyflyte serve connector --port 8000
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flytekitplugins_mmcloud-1.16.13.tar.gz.
File metadata
- Download URL: flytekitplugins_mmcloud-1.16.13.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ab40b0fb521373f4aba0333e2663e4a6e1673b811157a9bd13afe7b243127d3
|
|
| MD5 |
1c8e53dae84a9f254d6d290f53e210ec
|
|
| BLAKE2b-256 |
ec87e4ca844bd8063cf06d50f5411c25cc251fa769ed32a7b15f6bf47fccf124
|
File details
Details for the file flytekitplugins_mmcloud-1.16.13-py3-none-any.whl.
File metadata
- Download URL: flytekitplugins_mmcloud-1.16.13-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdbd1447bb62097448e04b8deb0db8d52637cb5018d858fccc582c05ff90d4ee
|
|
| MD5 |
536756d971a4d7684314b0e2a128e923
|
|
| BLAKE2b-256 |
0c3b070b9a36b9f5836914b6bd63b35e0462712ab57bb6d4d1d4f723c82a0408
|