code: def deserialize_pipeline(
      serialized_pipeline: str,
  ) -> tfx_pipeline.Pipeline:
      """Deserializes a TFX pipeline.
  
      To be replaced with the the TFX Intermediate Representation:
      tensorflow/community#271. This deserialization procedure reverses the
      serialization procedure and reconstructs the pipeline instance.
  
      Args:
        serialized_pipeline: Pipeline JSON string serialized with the procedure from
          _serialize_pipeline.
  
      Returns:
        Original pipeline containing pipeline args and components.
      """
  
      pipeline = json.loads(serialized_pipeline)
      components = [
          json_utils.loads(component)
          for component in pipeline["components"]
      ]
      for c in components:
          dsl_context_registry.get().put_node(c)
  
      metadata_connection_config = metadata_store_pb2.ConnectionConfig()
      json_format.Parse(
          pipeline["metadata_connection_config"],
          metadata_connection_config,
      )
  
      # Restore component dependencies.
      downstream_ids = pipeline["downstream_ids"]
      if not isinstance(downstream_ids, dict):
          raise ValueError("downstream_ids needs to be a 'dict'.")
      if len(downstream_ids) != len(components):
          raise ValueError(
              "Wrong number of items in downstream_ids. Expected: %s. Actual: %d"
              % len(components),
              len(downstream_ids),
          )
  
      id_to_component = {
          component.id: component for component in components
      }
      for component in components:
          # Since downstream and upstream node attributes are discarded during the
          # serialization process, we initialize them here.
          component._upstream_nodes = (
              set()
          )  # pylint: disable=protected-access
          component._downstream_nodes = (
              set()
          )  # pylint: disable=protected-access
  
      for upstream_id, downstream_id_list in downstream_ids.items():
          upstream_component = id_to_component[upstream_id]
          for downstream_id in downstream_id_list:
              upstream_component.add_downstream_node(
                  id_to_component[downstream_id]
              )
  
      return tfx_pipeline.Pipeline(
          pipeline_name=pipeline["pipeline_name"],
          pipeline_root=pipeline["pipeline_root"],
          components=components,
          enable_cache=pipeline["enable_cache"],
          metadata_connection_config=metadata_connection_config,
          beam_pipeline_args=pipeline["beam_pipeline_args"],
      )
  
file_path: tfx/tfx/orchestration/experimental/kubernetes/kubernetes_remote_runner.py
imports: import datetime
  import json
  import time
  from typing import Dict, List
  from absl import logging
  from kubernetes import client
  from tfx.dsl.components.base import base_node
  from tfx.dsl.context_managers import dsl_context_registry
  from tfx.orchestration import pipeline
  from tfx.orchestration.experimental.kubernetes import node_wrapper
  from tfx.utils import json_utils
  from tfx.utils import kube_utils
  from google.protobuf import json_format
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: deserialize_pipeline(serialized_pipeline) and returns: tfx_pipeline