"""Component config for Kubernets Pod execution."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from typing import Any, Dict, Text, Union

from kubernetes import client

from tfx.orchestration.config import base_component_config


class KubernetesComponentConfig(base_component_config.BaseComponentConfig):
  """Component config which holds Kubernetes Pod execution args.

  Attributes:
    pod: the spec for a Pod. It can either be an instance of client.V1Pod or a
      dict of a Pod spec. The spec details are:
      https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Pod.md
  """

  def __init__(self, pod: Union[client.V1Pod, Dict[Text, Any]]):
    if not pod:
      raise ValueError('pod must have a value.')
    self.pod = pod

"""Component config for Kubernets Pod execution."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from typing import Any, Dict, Text, Union

from kubernetes import client

from tfx.orchestration.config import base_component_config
from tfx.orchestration.launcher import container_common


class KubernetesComponentConfig(base_component_config.BaseComponentConfig):
  """Component config which holds Kubernetes Pod execution args.

  Attributes:
    pod: the spec for a Pod. It can either be an instance of client.V1Pod or a
      dict of a Pod spec. The spec details are:
      https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Pod.md
  """

  def __init__(self, pod: Union[client.V1Pod, Dict[Text, Any]]):
    if not pod:
      raise ValueError('pod must have a value.')
    self.pod = container_common.to_swagger_dict(pod)

Convert k8s pod spec into dict structure to make sure that it's json serializable.
Convert k8s pod spec into dict structure to make sure that it's json serializable.

PiperOrigin-RevId: 279162159

  """Component config for Kubernets Pod execution."""
  
  from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  
  from typing import Any, Dict, Text, Union
  
  from kubernetes import client
  
  from tfx.orchestration.config import base_component_config
+ from tfx.orchestration.launcher import container_common
  
  
  class KubernetesComponentConfig(base_component_config.BaseComponentConfig):
    """Component config which holds Kubernetes Pod execution args.
  
    Attributes:
      pod: the spec for a Pod. It can either be an instance of client.V1Pod or a
        dict of a Pod spec. The spec details are:
        https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Pod.md
    """
  
    def __init__(self, pod: Union[client.V1Pod, Dict[Text, Any]]):
      if not pod:
        raise ValueError('pod must have a value.')
-     self.pod = pod
+     self.pod = container_common.to_swagger_dict(pod)
  
Convert k8s pod spec into dict structure to make sure that it's json serializable.
## Code Before:
"""Component config for Kubernets Pod execution."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from typing import Any, Dict, Text, Union

from kubernetes import client

from tfx.orchestration.config import base_component_config


class KubernetesComponentConfig(base_component_config.BaseComponentConfig):
  """Component config which holds Kubernetes Pod execution args.

  Attributes:
    pod: the spec for a Pod. It can either be an instance of client.V1Pod or a
      dict of a Pod spec. The spec details are:
      https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Pod.md
  """

  def __init__(self, pod: Union[client.V1Pod, Dict[Text, Any]]):
    if not pod:
      raise ValueError('pod must have a value.')
    self.pod = pod

## Instruction:
Convert k8s pod spec into dict structure to make sure that it's json serializable.
## Code After:
"""Component config for Kubernets Pod execution."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from typing import Any, Dict, Text, Union

from kubernetes import client

from tfx.orchestration.config import base_component_config
from tfx.orchestration.launcher import container_common


class KubernetesComponentConfig(base_component_config.BaseComponentConfig):
  """Component config which holds Kubernetes Pod execution args.

  Attributes:
    pod: the spec for a Pod. It can either be an instance of client.V1Pod or a
      dict of a Pod spec. The spec details are:
      https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Pod.md
  """

  def __init__(self, pod: Union[client.V1Pod, Dict[Text, Any]]):
    if not pod:
      raise ValueError('pod must have a value.')
    self.pod = container_common.to_swagger_dict(pod)
