https://flyte.org logo
#ask-the-community
Title
# ask-the-community
a

Abdullah Mobeen

08/30/2023, 5:16 PM
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

Abdullah Mobeen

08/30/2023, 5:38 PM
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

Yicheng Lu

08/30/2023, 5:39 PM
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

Abdullah Mobeen

08/30/2023, 5:49 PM
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

Yicheng Lu

08/30/2023, 5:54 PM
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

Samhita Alla

08/31/2023, 5:10 AM
Are you able to get this to work @Abdullah Mobeen?
2 Views