Hey. I am trying to run flytectl on my Macbook Air M3. This is an apple silicon architecture (aka A...
g
Hey. I am trying to run flytectl on my Macbook Air M3. This is an apple silicon architecture (aka ARM64). I have a docker image that I have built which is built for platform=linux/amd64 that I want to use for my workflow/tasks. I have specified this in the the
pyflyte register
command using the
--image
tag, but I am not having any luck forcing the flytectl cluster to use the AMD64 architecture. I started the demo specifically with this env variable
flytectl demo start --env DOCKER_DEFAULT_PLATFORM=linux/amd64
(which theoretically should force docker to try to pull amd64 images?). I am getting errors in my workflow that it can't find the container
Copy code
[1/1] currentAttempt done. Last Error: USER::Grace period [3m0s] exceeded|containers with unready status: [afqwjjtbs6n4ltk4pd9l-n0-0]|Back-off pulling image "localhost:30000/my-image:latest"
Below is what I used to build/push/install the workflow:
Copy code
docker build -t my-image:latest --platform=linux/amd64 .
docker tag detekt-challenge:latest localhost:30000/my-image:latest
docker push localhost:30000/my-image:latest
pyflyte register --project my-project --image localhost:30000/my-image:latest src
At this point I am not sure if this is an architecture issue or something else not working. I did verify I can pull the image back to my local machine (so the docker registry is running). How can I test this locally with
flytectl
? Thanks 🙂
a
DOCKER_DEFAULT_PLATFORM=linux/amd64
I think this is for emulation. To build locally on M1 I have used ImageSpec and the
platform="linux/arm64"
argument
g
I could have sworn I tried to use this, and it still didn’t work. I’ll give it another attempt in a bit
It appears that this platform flag is only used for building images. It is not used for when the tasks/workflows are started: https://github.com/flyteorg/flytekit/blob/master/flytekit/image_spec/default_builder.py#L483
From my understanding, to edit flytekit to allow for a specific platform to be specified for tasks: platform needs to be added as an arg here: https://github.com/flyteorg/flytekit/blob/626c4b7467119301134a225ebe5fbc262694ea58/flytekit/core/container_task.py#L271 and as an arg here: https://github.com/flyteorg/flytekit/blob/626c4b7467119301134a225ebe5fbc262694ea58/flytekit/core/container_task.py#L193 Otherwise it is currently not possible to override the platform for tasks (just when building them, but then it fails to pull/run them because the platform I am wanting to use does not exist in the docker registry)
f
@glamorous-pizza-44029 any change u manage to fix this issue somehow?
g
Hey @fierce-monitor-77717 No, I never got this to work. I pointed out above where the issue is, but was not confident enough in how the Flyte repository works to submit a PR for it. Theoretically, there just needs to be the extra params passed to the docker API when trying to pull the images. My "workaround" was to actually just make my Dockerfile for my Flyte task actually work on ARM and not only AMD64 (which is what I was originally trying to do). Sorry I can't be of more help
b
Hiya 👋 , having a similar issue with this too, on an M4 Pro MBP and it breaks the Getting Started guide for me. Looking at the Flyte Demo container logs:
Copy code
E0509 16:11:11.973535      75 remote_image.go:180] "PullImage from image service failed" err="rpc error: code = NotFound desc = failed to pull and unpack image \"localhost:30000/say-hello-image:Y0RqVPnX2_221ovInaIIqw\": no match for platform in manifest: not found" image="localhost:30000/say-hello-image:Y0RqVPnX2_221ovInaIIqw"
But I can run the image (via Docker Desktop with Rosetta enabled), albeit with a warning:
Copy code
$ docker run --rm localhost:30000/say-hello-image:Y0RqVPnX2_221ovInaIIqw echo 'hello'
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
hello
Slightly modified `hello_world.py`:
Copy code
# Hello World

import flytekit as fl

image_spec = fl.ImageSpec(
    # The name of the image. This image will be used by the `say_hello`` task.
    name="say-hello-image",
    # Lock file with dependencies to be installed in the image.
    requirements="uv.lock",
    # Image registry to to which this image will be pushed.
    # Set the Environment variable FLYTE_IMAGE_REGISTRY to the URL of your registry.
    # The image will be built on your local machine, so enure that your Docker is running.
    # Ensure that pushed image is accessible to your Flyte cluster, so that it can pull the image
    # when it spins up the task container.
    registry="localhost:30000",
)


@fl.task(container_image=image_spec)
def say_hello(name: str) -> str:
    return f"Hello, {name}!"


@fl.workflow
def hello_world_wf(name: str = "world") -> str:
    greeting = say_hello(name=name)
    return greeting
Adding
platform="linux/arm64"
to the
ImageSpec
works 🎉 (thank you for that), it might be useful to add that to the docs. It'd also be useful to point out the bundled image registry on
localhost:30000
in the getting started guide as well, as that's great for local testing but not advertised in the guide.