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

Broder Peters

03/03/2023, 12:11 PM
Any way to run the ShellTask on a specific image right now (besides using another image for the whole workflow)? To my understanding, is neither the task_config option nor the pod_template argument yet possible, right? Can I use ShellTasks right now only with the flyte image that runs by default on tasks?
Just remembered that flyte will instruct the task anyway with the
pyflyte-fast-execute
stuff, meaning that if I would want to run a non-python related shelltask, it's just not possible right now, right?
My current workaround that might work:
Copy code
from flytekit import task, workflow
from flytekitplugins.pod import Pod
from kubernetes.client.models import (
    V1Container,
    V1PodSpec,
)

@task(
    task_config=Pod(
        pod_spec=V1PodSpec(
            containers=[
                V1Container(
                    name="kaniko",
                    image="<http://gcr.io/kaniko-project/executor:latest|gcr.io/kaniko-project/executor:latest>",
                    args=[
                        "--help"
                    ]
                ),
            ]
        ),
    )
)
def kaniko_dummy():
    pass


@workflow
def wf():
    kaniko_dummy()
f

Felix Ruess

03/03/2023, 12:51 PM
If you just need to run a command/script in the image you can use ContainerTask... But you should also be able to specify the image for ShellTask
As long as you don't need a full pod spec, this is already supported
d

Dan Rammer (hamersaw)

03/03/2023, 2:12 PM
@Broder Peters for context ContainerTasks allow you to specify the image. This seems to fit your use case. Otherwise, I haven't tested this, but the ShellTask has a task_config that can only be set to Pod. So you should be able to do something like:
Copy code
ShellTask(
    # other args omitted
    task_config=Pod(
        pod_spec=V1PodSpec(
            containers=[
                V1Container(
                    name="primary",
                    image="<http://gcr.io/kaniko-project/executor:latest|gcr.io/kaniko-project/executor:latest>",
                ),
            ]
        ),
    )
)
which would set the container.
b

Broder Peters

03/03/2023, 2:15 PM
oh damn completely missed the containertask somehow... Thanks for the input!
k

Ketan (kumare3)

03/03/2023, 2:42 PM
Also, you can change image of a task using. Dynamic
73 Views