Get the image name inside KFP component definition

169 views Asked by At

I have a python function that is converted to KFP component using @component decorator, like this:

@component(
    base_image="image_name:image_tag",
)
def func(arg1):
    # I want to get the image used here, e.g. I want to get image = "image_name:image_tag" because I want to use it in the logic inside the function
    if image == "image_name:image_tag":
        do_something
    else:
        do_something_else

Is it possible? Thanks

1

There are 1 answers

0
Dakota On

The approach that I would take here is to create an optional parameter that has a default value of the name of your typical base image. Then you can perform your logic based on the parameter value. As far as I know, the documentation does not show the ability to read the base image name defined in the component decorator.