acoustic-carpenter-78188
01/26/2023, 8:55 AMpod_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
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
@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 checksacoustic-carpenter-78188
02/03/2023, 12:34 AM