flytekit
flytekit copied to clipboard
Agent/skypilot
Tracking issue
https://github.com/flyteorg/flyte/issues/3936
Why are the changes needed?
Skypilot agent
What changes were proposed in this pull request?
Please refer to the diagram
How was this patch tested?
Setup process
sky_test.py
from flytekit import task, workflow, Secret
from flytekitplugins.skypilot import SkyPilot, SkyPilotFunctionTask
# import sky
from flytekit.configuration import Config, SecretsConfig, SerializationSettings
import flytekit
import textwrap
IMTERNAL_IMAGE = "flytesky/plugins:skypilot" # "cr.flyte.org/flyteorg/flytekit:py3.10-latest"
@task(
task_config=SkyPilot(
cluster_name="t2",
# prompt_cloud=True,
resource_config={
"instance_type": "e2-small",
"use_spot": True,
},
container_run_type=0,
job_launch_type=0,
setup=textwrap.dedent(
"""\
python -m pip install -e /flytekit
pip install numpy==1.26.4
"""
)
),
container_image=IMTERNAL_IMAGE,
)
def t3(a: int) -> int:
return (a + 3)
@workflow
def wf(a: int = 3):
r = t3(a=a)
r2 = t3(a=r)
return r2
if __name__ == "__main__":
wf()
To test it locally or in sandbox environment, users need to run python sky_server.py
pyflyte --verbose run --remote sky_test.py wf --a "3"
Screenshots
Check all the applicable boxes
- [ ] I updated the documentation accordingly.
- [ ] All new and existing tests passed.
- [ ] All commits are signed-off.