SkyPilot is a framework for running LLMs, AI, and batch jobs on any cloud, offering maximum cost savings, highest GPU availability, and managed execution.
Flyte can utilize SkyPilot to execute a Flyte task on any cloud and allocate a GPU for you.
Any task with SkyPilot config will be submitted to other cloud by the SkyPilot agent.
In the below example, t1
and t2
task will reuse the same cluster.
from flytekit import task, workflow
from flytekitplugins.skypilot import SkyPilot
@task(task_config=SkyPilot(cluster_name="foo"))
def t1() -> int:
return 3 + 2
@task(task_config=SkyPilot(cluster_name="foo"))
def t2(a: int) -> int:
return a + 3
@workflow
def wf(a: int = 3):
t1()
t2(a=a)
This implentation is similar to Databricks Task.
@dataclass
class SkyPilot(object):
cluster_name: str
...
class SkyPilotFunctionTask(AsyncAgentExecutorMixin, PythonFunctionTask[SkyPilot]):
_TASK_TYPE = "skypilot"
def __init__(
self,
task_config: SkyPilot,
task_function: Callable,
container_image: Optional[Union[str, ImageSpec]] = None,
**kwargs,
):
super(PysparkFunctionTask, self).__init__(
task_config=task_config,
task_type=self.__init__,
task_function=task_function,
container_image=container_image,
**kwargs,
)
def get_custom(self, settings: SerializationSettings) -> Dict[str, Any]:
return asdict(self.task_config)
This agent submits jobs by leveraging SkyPilot. The TaskTemplate
contains all the necessary job information to create a SkyPilot task specification, including the image, command, resources, input, and output paths.
from typing import Optional
from dataclasses import dataclass
from flytekit.models.literals import LiteralMap
from flytekit.models.task import TaskTemplate
from flytekit.extend.backend.base_agent import AsyncAgentBase, AgentRegistry, Resource, ResourceMeta
@dataclass
class SkyPilotMetadata(ResourceMeta):
"""
This is the metadata for the job.
"""
job_id: str
cluster_name: str
cloud: Optional[str]
region: Optional[str]
class SkyPilotAgent(AsyncAgentBase):
def __init__(self):
super().__init__(task_type_name="skypilot", metadata_type=SkyPilotMetadata)
def create(
self,
task_template: TaskTemplate,
inputs: Optional[LiteralMap] = None,
**kwargs,
) -> SkyPilotMetadata:
cluster_name = task_template.custom["cluster_name"]
resource = task_template.container.resource
image = task_template.container.image
task = sky.Task(run=task_template.container.args, image_id=image)
job_id = sky.launch(task=task, cluster_name=cluster_name, resource=resource)
return SkyPilotMetadata(job_id=job_id, cluster_name=cluster_name)
def get(self, resource_meta: SkyPilotMetadata, **kwargs) -> Resource:
phase, outputs = get_skypilot_job_status(...)
return Resource(phase=phase, outputs=outputs)
def delete(self, resource_meta: SkyPilotMetadata, **kwargs):
sky.down(resource_meta.cluster_name)
# To register the skypilot agent
AgentRegistry.register(SkyPilotAgent())
Motivation Currently it is hard to implement backend plugins, especially for data-scientists & MLE’s who do not have working knowledge of Golang. Also, performance requirements, maintenance and development is cumbersome. The document here proposes a path to make it possible to write plugins rapidly, while decoupling them from the core flytepropeller engine. Goals Plugins should be easy to author - no need of code generation, using tools that MLEs and Data Scientists are not accustomed to using. Most important plugins for Flyte today are plugins that communicate with external services. It should be possible to test these plugins independently and also deploy them privately. It should be possible for users to use backend plugins for local development, especially in flytekit and unionML
Dec 28, 2023PR: https://github.com/flyteorg/flytekit/pull/1782
Sep 8, 2023Issues Discussion Motivation: Why do you think this is important? Currently flyteadmin notifications are delivered using the PagerDuty, Github and Slack email APIs. On AWS deployments FlyteAdmin uses SES to trigger emails, for all others the only alternative email implementation is SendGrid integration. Setting up SES or SendGrid can be somewhat complicated. Furthermore, asking your Flyte users to configure the aforementioned services with email integrations adds even more overhead. It would be simpler as an alternative to provide webhook integration for notification so that users only have to configure existing API keys for PagerDuty/Github/Slack. Flyte currently only allows sending notifications by email and requires users to explicitly define notification rules in their launchplans. FlyteAdmin Webhook
Jun 5, 2023Save Model to submarine model registry by adding submarine.save_model(model, "tensorflow") in your script import tensorflow_datasets as tfds import tensorflow as tf from tensorflow.keras import layers, models import submarine def make_datasets_unbatched(): BUFFER_SIZE = 10000
May 19, 2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up