Any way to run the ShellTask on a specific image r...
# ask-the-community
b
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
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
@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
oh damn completely missed the containertask somehow... Thanks for the input!
k
Also, you can change image of a task using. Dynamic
152 Views