Open yifengwang66 opened 1 month ago
In kfp-kubernetes (since version 1.3.0) you have Pod Labels and Annotations
Example usage (for Cloud TPU pods)
@dsl.component(base_image="tensorflow/tensorflow:2.18.0-gpu")
def check_tpu_availability() -> list:
import tensorflow as tf
devices = tf.config.list_logical_devices()
devices = [device for device in devices]
return devices
@dsl.pipeline(name="TF-Device-Check")
def tpu_check_pipeline():
task = check_tpu_availability()
kubernetes.add_pod_annotation(
task,
annotation_key='tf-version.cloud-tpus.google.com',
annotation_value='2.18.0',
)
This however requires kubeflow version 1.9 to support it (SDK version 2.2), otherwise you'll get a nasty Exit Code 1 when you try to launch a pod that upon inspection looks like
failed to unmarshal Kubernetes config, error: unknown field "podMetadata" in kfp_kubernetes.KubernetesExecutorConfig
Discussed in https://github.com/kubeflow/pipelines/discussions/11014