code: def testMNISTPipelineNativeKeras(self):
      if not tf.executing_eagerly():
          self.skipTest("The test requires TF2.")
      BeamDagRunner().run(
          mnist_pipeline_native_keras._create_pipeline(
              pipeline_name=self._pipeline_name,
              data_root=self._data_root,
              module_file=self._module_file,
              module_file_lite=self._module_file_lite,
              serving_model_dir=self._serving_model_dir,
              serving_model_dir_lite=self._serving_model_dir_lite,
              pipeline_root=self._pipeline_root,
              metadata_path=self._metadata_path,
              beam_pipeline_args=[],
              accuracy_threshold=0.5,
          )
      )  # Use a low value to make test stable.
  
      self.assertTrue(fileio.exists(self._serving_model_dir))
      self.assertTrue(fileio.exists(self._serving_model_dir_lite))
      self.assertTrue(fileio.exists(self._metadata_path))
      metadata_config = metadata.sqlite_metadata_connection_config(
          self._metadata_path
      )
      expected_execution_count = 11
      with metadata.Metadata(metadata_config) as m:
          artifact_count = len(m.store.get_artifacts())
          execution_count = len(m.store.get_executions())
          self.assertGreaterEqual(artifact_count, execution_count)
          self.assertEqual(execution_count, expected_execution_count)
  
      self.assertPipelineExecution()
  
      # Runs pipeline the second time.
      BeamDagRunner().run(
          mnist_pipeline_native_keras._create_pipeline(
              pipeline_name=self._pipeline_name,
              data_root=self._data_root,
              module_file=self._module_file,
              module_file_lite=self._module_file_lite,
              serving_model_dir=self._serving_model_dir,
              serving_model_dir_lite=self._serving_model_dir_lite,
              pipeline_root=self._pipeline_root,
              metadata_path=self._metadata_path,
              beam_pipeline_args=[],
              accuracy_threshold=0.5,
          )
      )  # Use a low value to make test stable.
  
      # Asserts cache execution.
      with metadata.Metadata(metadata_config) as m:
          # Artifact count is unchanged.
          self.assertLen(m.store.get_artifacts(), artifact_count)
          self.assertLen(
              m.store.get_executions(), expected_execution_count * 2
          )
  
file_path: tfx/tfx/examples/mnist/mnist_pipeline_native_keras_e2e_test.py
imports: import os
  import tensorflow
  from tfx.dsl.io import fileio
  from tfx.examples.mnist import mnist_pipeline_native_keras
  from tfx.orchestration import metadata
  from tfx.orchestration.beam.beam_dag_runner import BeamDagRunner
label_desc: Use image node_id 4 for calling the MNISTPipelineNativeKerasEndToEndTest obj's underlying member method code with example usage: obj.testMNISTPipelineNativeKeras() without return types