I have a very subtle bug. My workflow looks simila...
# flyte-support
r
I have a very subtle bug. My workflow looks similar to this:
Copy code
my_image = ImageSpec(name='my_custom_image',
                     builder='noop',
                     base_image='my-custom/base-image:abc')

@task(container_image=my_image)
def create_dataframe() -> str:
    return "DataFrame created successfully!"

@dynamic
def my_dynamic_workflow() -> str:
    """
    This dynamic workflow calls the task.
    """
    # The dynamic workflow context automatically runs this task.
    result = create_dataframe()
    return result
When then
@dynamic
workflow runs, it tries to kick off a
task
with the default flyte image instead of my
my-custom/base-image:abc
image. Now clearly the image builder is not supposed to run during a Flyte execution itself (at least i see an if-guard to that effect)... but this is the no-op builder which doesn't actually need to build. So what inside the
dynamic
workflow is preventing my `ImageSpec`'s image name from NOT getting reported properly?
e
Why do you need to use ImageSpec in this case? Can't you directly use the container, e.g.
Copy code
@task(container_image="my-custom/base-image:abs")
?
r
oh huh, then what's the point of noop builder ... ?
e
🤷
r
blarg you're right, this appears to work fine. I do see now that
container_image
has type
str | ImageSpec
, but all the docs I see say to use ImageSpec? i guess because folks generally want to add new dependencies.
ohhhh so i guess ImageSpec here is for the case where like you don't change the base image but rather you want to run ImageSpec stuff like install packages at runtime https://github.com/flyteorg/flytekit/pull/3231
e
oh, right! I had forgotten about that use case
r
alright welp it might help if docs and LLMs coax users towards the simpler
container_image
str
option, as yeah appears ImageSpec + dynamic tasks maybe not work so well
e
I'm not sure it has anything to do w/ the dynamic workflow. It's just that the noop builder doesn't do anything so the base_image arg is ignored
r
well if i had
workflow
instead of
dynamic
, then i think my ImageSpec gets run as expected and the task uses the desired image. But in
dynamic
, ImageBuilders not supposed to run. I think there is still an underlying issue where
ImageSpec
does too much complex stuff to decide the image name in the case of
noop
builder, and so stuff will break. Perhaps this all changes in Flyte 2.0 since everything is dynamic by default.