code: def setUp(self):
      super().setUp()
      pipeline_root = os.path.join(
          os.environ.get(
              "TEST_UNDECLARED_OUTPUTS_DIR", self.get_temp_dir()
          ),
          self.id(),
      )
      self._pipeline_root = pipeline_root
  
      # Makes sure multiple connections within a test always connect to the same
      # MLMD instance.
      metadata_path = os.path.join(
          pipeline_root, "metadata", "metadata.db"
      )
      self._metadata_path = metadata_path
      self._mlmd_cm = mlmd_cm.MLMDConnectionManager.sqlite(
          metadata_path
      )
      self.enter_context(self._mlmd_cm)
      self._mlmd_connection = self._mlmd_cm.primary_mlmd_handle
  
      # Sets up the pipeline.
      pipeline = test_async_pipeline.create_pipeline()
      self._pipeline = pipeline
      self._pipeline_info = pipeline.pipeline_info
      self._pipeline_runtime_spec = pipeline.runtime_spec
      self._pipeline_runtime_spec.pipeline_root.field_value.string_value = (
          pipeline_root
      )
  
      # Extracts components.
      self._example_gen = pipeline.nodes[0].pipeline_node
      self._transform = pipeline.nodes[1].pipeline_node
      self._trainer = pipeline.nodes[2].pipeline_node
  
      self._task_queue = tq.TaskQueue()
  
      self._mock_service_job_manager = mock.create_autospec(
          service_jobs.ServiceJobManager, instance=True
      )
  
      def _is_pure_service_node(unused_pipeline_state, node_id):
          return node_id == self._example_gen.node_info.id
  
      def _is_mixed_service_node(unused_pipeline_state, node_id):
          return node_id == self._transform.node_info.id
  
      self._mock_service_job_manager.is_pure_service_node.side_effect = (
          _is_pure_service_node
      )
      self._mock_service_job_manager.is_mixed_service_node.side_effect = (
          _is_mixed_service_node
      )
      self._mock_service_job_manager.stop_node_services.return_value = (
          True
      )
  
      def _default_ensure_node_services(
          unused_pipeline_state, node_id, unused_backfill_token=""
      ):
          self.assertIn(
              node_id,
              (
                  self._example_gen.node_info.id,
                  self._transform.node_info.id,
              ),
          )
          return service_jobs.ServiceStatus(
              code=service_jobs.ServiceStatusCode.RUNNING
          )
  
      self._mock_service_job_manager.ensure_node_services.side_effect = (
          _default_ensure_node_services
      )
  
imports: import os
  from absl.testing import parameterized
  from absl.testing.absltest import mock
  import tensorflow
  from tfx.orchestration import node_proto_view
  from tfx.orchestration.experimental.core import async_pipeline_task_gen
  from tfx.orchestration.experimental.core import pipeline_state
  from tfx.orchestration.experimental.core import service_jobs
  from tfx.orchestration.experimental.core import task
  from tfx.orchestration.experimental.core import task_gen_utils
  from tfx.orchestration.experimental.core import task_queue
  from tfx.orchestration.experimental.core import test_utils
  from tfx.orchestration.experimental.core.testing import test_async_pipeline
  from tfx.orchestration import mlmd_connection_manager
  from tfx.orchestration.portable.input_resolution import exceptions
  from tfx.utils import status
label_desc: Use image node_id 1 for calling the AsyncPipelineTaskGeneratorTest obj's underlying member method code with example usage: obj.setUp() and returns: unknown, unknown, service_jobs