flyte: [BUG] Task node overrides not handled in flyteidl are broken

Describe the bug

Let’s take container_image as an example for a task node override:

@task
def foo() -> str:
    return "foo"


@workflow
def wf():
    foo().with_overrides(
        container_image="{{.image.default.fqn}}:" + "9410d0f0ed4a25577ab35a79bd3eb1119d8627d59c7a8fb947d42ca9fb46a61c"
    )

If one runs this workflow with pyflyte run, everything works as expected. If, however, one uses pyflyte register and runs it manually from the UI, the default image is used.


@workflow
def wf():
    foo().with_overrides(container_image="ubuntu:foo")
    foo().with_overrides(container_image="ubuntu:bar")

Another problem is that even if one uses pyflyte run, in this example both task nodes will use the image "ubuntu:bar".

Expected behavior

The reason for this behaviour is that only resource/extended resource overrides are treated as workflow-level task-node overrides which are registered separately from the task themselves and then overridden in the backend.

Other overrides such as container_image override the task-level metadata before the registration process. These can only be used once as “the last override wins” and appear to not work with pyflyte register.

The proper fix is to treat all overrides as task node overrides in flyteidl instead of overriding task-level metadata before registration.


Are you sure this issue hasn’t been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 22 (17 by maintainers)

Most upvoted comments

We’re currently seeing this/similar with even basic image overrides in 1.11.0 (successful in 1.10.7):

from flytekit import task, workflow

@task(container_image='my-repo/flyte-evotorch:0.3.0')
def my_task():
    print("I'm a task!")

@workflow
def wf():
    my_task().with_overrides(container_image='my-repo/flyte-evotorch:0.0.1-xxxx')

Running via

pyflyte --verbose run --project ABC --remote wf

The task retains the @task(container_image=xxx) rather than using the .with_overrides specification

Just to expand on ^, if you’re looking at the Task Template (in the flyteconsole task details tab) then you’ll see the wrong info, as the container image (and other overridden fields) are only present at the workflow spec level.

In other words, in the backend we override the container image, but not in the task template. One could argue that this is misleading (and indeed is), but there’s no regression in the functionality. We should open a separate gh issue to track this flyteconsole way of visualizing overrides.

🤖

Hello @fg91,

I’m Dosu, an AI here to assist you with your issues and questions about flyte. While we’re waiting for a human maintainer to respond, I’m here to provide preliminary help and guide you through the process. Let’s work together to solve this bug!

Thank you for reporting this issue. I found a similar issue in the Flyte repository: [BUG] container_image override does not work with map_task. This issue was addressed in the following pull requests: Override the container image of map task and Allow contributors to self-assign issues with GitHub workflow.

However, I wasn’t able to find specific details on how pyflyte run and pyflyte register handle the container_image override differently in the codebase. The underlying mechanism that allows container_image to be overridden in the Flyte codebase involves modifying the Image field of the CoreContainer struct in the flyteadmin package. This change will not affect running containers, only new ones that are created after the change.

Here is an example of how you might override the container_image:

container := flyteadmin.CoreContainer{
    Image: "new_image:tag",
    // other fields...
}

In this example, the container_image is overridden to be “new_image:tag”. You can find more details in the flyteidl/gen/pb-go/flyteidl/service/flyteadmin/model_core_container.go file.

I hope this information is helpful. If you have more details or context that could help in understanding the issue better, please share.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.