The Flyte 2 devbox is a great way to try a simplified Union.ai cluster on your local machine.
Run locally on the devbox
The devbox is a lightweight local cluster that runs on your machine with Docker. It includes a UI preview, scheduler, and object store, so you can test remote execution without deploying to a real cluster.
What you’ll need
Install the SDK
If you haven’t already, install the flyte package:
pip install flyteStart the devbox
Launch the local cluster:
flyte start devboxflyte start devbox --gpu--gpu flag requires an NVIDIA-enabled host. It currently does not support Apple Silicon or AMD GPUs.
This pulls the necessary containers and starts a local Flyte instance. Once ready, the Flyte UI is available at http://localhost:30080.
Check the devbox status
flyte get devbox requires flyte 2.6.2 or later.
To see whether the devbox is up, and where it is:
flyte get devboxThis reports the run state, the UI and image registry endpoints, the container image version in use, and where the cluster keeps its state on disk. It is the quickest way to tell a devbox that is still starting from one that is ready.
Add --no-probes to skip the readiness probe and the container resource sample, which makes the check faster and works offline:
flyte get devbox --no-probesFor a machine-readable report, pass an output format to the top-level command:
flyte -of json-raw get devboxConfigure
Create a config file that points to the devbox:
flyte create config --devboxThis creates .flyte/config.yaml configured to talk to your local devbox cluster.
The --devbox flag requires flyte 2.6.1 or later. It is a shortcut for the explicit form, which you need on earlier versions:
flyte create config \
--endpoint localhost:30080 \
--project flytesnacks \
--domain development \
--builder local \
--insecureBoth forms write the same config file. One difference: in an interactive terminal the explicit form offers to reuse a Docker login as your image registry, while --devbox skips that prompt, because the devbox pushes to its own in-cluster registry.
--devbox cannot be combined with --endpoint, but you can still override the project and domain alongside it:
flyte create config --devbox --project my-project --domain stagingRun a workflow on the devbox
Using the same hello.py from the
Quickstart:
# hello.py
import flyte
# The `hello_env` TaskEnvironment is assigned to the variable `env`.
# It is then used in the `@env.task` decorator to define tasks.
# The environment groups configuration for all tasks defined within it.
env = flyte.TaskEnvironment(name="hello_env")
# We use the `@env.task` decorator to define a task called `fn`.
@env.task
def fn(x: int) -> int: # Type annotations are required
slope, intercept = 2, 5
return slope * x + intercept
# We also use the `@env.task` decorator to define another task called `main`.
# This is the entrypoint task of the workflow.
# It calls the `fn` task defined above multiple times using `flyte.map`.
@env.task
def main(x_list: list[int] = list(range(10))) -> float:
y_list = list(flyte.map(fn, x_list)) # flyte.map is like Python map, but runs in parallel.
y_mean = sum(y_list) / len(y_list)
return y_mean
Run it on the devbox:
flyte run hello.py mainWithout the --local flag, the workflow runs on the devbox cluster rather than in your local Python process. Tasks execute inside containers, just like they would on a remote cluster.
View results in the UI
Open http://localhost:30080 to see your workflow execution in the Flyte UI. You can inspect task inputs, outputs, logs, and execution timelines.
Stop the devbox
When you’re done, shut down the cluster:
flyte stop devboxInline configuration
Skip the config file entirely by passing parameters directly.
Use flyte.init:
flyte.init(
endpoint="localhost:30080",
project="flytesnacks",
domain="development",
insecure=True,
)Some parameters go after flyte, others after the subcommand:
flyte \
--endpoint localhost:30080 \
--insecure \
--builder local \
run \
--domain development \
--project flytesnacks \
hello.py \
mainSee the CLI reference for details.
Delete the devbox
flyte delete devbox # add the --volume flag to delete the Docker volumeUsing a CUDA-enabled GPU host
If you started the devbox with flyte start devbox --gpu, you can use GPUs in your workflows.
import flyte
env = flyte.TaskEnvironment(
name="gpu_env",
resources=flyte.Resources(gpu=1),
)
@env.task
def gpu_task() -> bool:
return torch.cuda.is_available() # returns True if CUDA (provided by a GPU) is available