Hi all, does anyone have a good example of using d...
# ask-the-community
a
Hi all, does anyone have a good example of using different images for different tasks using
flytekit
? We have a base image for our workflow that's in a GCR project. We have another image in a different GCR project that we want to use for one task that requires additional dependencies. What's the best way to achieve this?
a
Thanks! I was just going through this doc. Can you help me understand this format:
Copy code
"{{.image.mindmeld.fqn}}:{{.image.mindmeld.version}}"
can I provide the GCR image url?
y
here's code I wrote before:
Copy code
from typing import List, Dict, Any, Annotated
from flytekit import task, Resources, workflow
@task(
    limits=Resources(mem="4Gi",cpu="1"),
    disable_deck=True,
    container_image="{{.image.oldImage}}",
    cache=True, cache_version="1.0"   
)
def task0() -> List[List[Any]]:
    return   [ ["foo","foo","foo"] ] * 2
@task(
    limits=Resources(mem="4Gi",cpu="1"),
    disable_deck=True,
    container_image="{{.image.prImage}}",
)
def task1(data: List[List[Any]]) -> List[List[Any]]:
    print(data)
    return  data
@workflow
def wf():
    data = task0()
    task1(data=data)
# pyflyte run --image prImage="yichenglu/flytekit:mytest4" --image oldImage="<http://cr.flyte.org/flyteorg/flytekit:py3.10-1.4.1|cr.flyte.org/flyteorg/flytekit:py3.10-1.4.1>" --remote ./test.py  wf
Copy code
"{{.image.mindmeld.fqn}}:{{.image.mindmeld.version}}"
Seems a template. fqn is full qualified name of the image. version is tag of the image.
a
Thanks for the code! I'm not using pyflyte to trigger my workflow so I'm wondering how to provide the image name cc @Samhita Alla
y
The type of container_image is Optional[Union[str, ImageSpec]]. So, just set the container_image field with the string of your GCR image url.
s
Are you able to get this to work @Abdullah Mobeen?