<#1425 Add `pod_template` and `pod_template_name` ...
# flyte-github
a
#1425 Add `pod_template` and `pod_template_name` arguments for `PythonAutoContainerTask`, its downstream tasks, and `@task`. Pull request opened by ByronHsu TL;DR Add
pod_template
and
pod_template_name
arguments for
PythonAutoContainerTask
, its downstream tasks, and
@task
. (Following this guide) Type ☐ Bug Fix ☑︎ Feature ☐ Plugin Are all requirements met? ☐ Code completed ☐ Smoke tested ☑︎ Unit tests added ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description 1. Users can pass in
pod_template
in
PythonAutoContainerTask
, its downstream tasks, and
@task
to customize
pod_template
for each task instance. It also allows developers to set the default
pod_template
for plugins in flytekit. 2. Users can pass in
pod_template_name
in
PythonAutoContainerTask
, its downstream tasks, and
@task
to select which
PodTemplate
resources to use on the server side. Example • instance
Copy code
task_with_minimum_pod_template = DummyAutoContainerTask(
    name="x",
    task_config=None,
    task_type="t",
    container_image="repo/image:0.0.0",
    pod_template=PodTemplate(
        primary_container_name="primary",
        labels={"lKeyA": "lValA"},
        annotations={"aKeyA": "aValA"},
        pod_spec=V1PodSpec(
            containers=[
                V1Container(
                    name="primary",
                ),
            ]
        ),
    ),
    pod_template_name="A",
)
• decorator
Copy code
@task(
        container_image="repo/image:0.0.0",
        pod_template=PodTemplate(
            primary_container_name="primary",
            labels={"lKeyA": "lValA"},
            annotations={"aKeyA": "aValA"},
            pod_spec=V1PodSpec(
                containers=[
                    V1Container(
                        name="primary",
                    ),
                ]
            ),
        ),
        pod_template_name="A",
    )
    def func_with_pod_template(i: str):
        print(i + 3)
Tracking Issue flyteorg/flyte#3123 flyteorg/flytekit ✅ All checks have passed 30/30 successful checks