code: def test_counters(self):
      self._exec_properties[
          standard_component_specs.PREPROCESSING_FN_KEY
      ] = self._preprocessing_fn
      self._exec_properties[
          standard_component_specs.DISABLE_STATISTICS_KEY
      ] = True
      metrics = self._run_pipeline_get_metrics()
  
      # The test data has 9909 instances in the train dataset, and 5091 instances
      # in the eval dataset (obtained by running:
      # gqui third_party/py/tfx/components/testdata/csv_example_gen/Split-train/ \
      # data* \ 'select count(*)'
      # )
      # Since the analysis dataset (train) is read twice (once for analysis and
      # once for transform), the expected value of the num_instances counter is:
      # 9909 * 2 + 5091 = 24909. (SE - 10500 * 2 + 4500 = 25500)
      self.assertMetricsCounterEqual(
          metrics,
          "num_instances",
          self._TEST_COUNTERS["num_instances"],
          ["tfx.Transform"],
      )
  
      # Since disable_statistics is True, TFDV should see 0 instances.
      self.assertMetricsCounterEqual(
          metrics, "num_instances", 0, ["tfx.DataValidation"]
      )
  
      # We expect 2 saved_models to be created because this is a 1 phase analysis
      # preprocessing_fn.
      self.assertMetricsCounterEqual(metrics, "saved_models_created", 2)
  
      # This should be the size of the preprocessing_fn's inputs dictionary which
      # is 18 (SE - 3) according to the schema.
      self.assertMetricsCounterEqual(
          metrics,
          "total_columns_count",
          self._TEST_COUNTERS["total_columns_count"],
      )
  
      # There are 9 (SE - 2) features that are passed into tft analyzers in the
      # preprocessing_fn.
      self.assertMetricsCounterEqual(
          metrics,
          "analyze_columns_count",
          self._TEST_COUNTERS["analyze_columns_count"],
      )
  
      # In addition, 7 features go through a pure TF map, not including the label,
      # so we expect 9 + 7 + 1 = 17 transform columns.
      self.assertMetricsCounterEqual(
          metrics,
          "transform_columns_count",
          self._TEST_COUNTERS["transform_columns_count"],
      )
  
      # There should be 1 path used for analysis since that's what input_dict
      # specifies.
      self.assertMetricsCounterEqual(metrics, "analyze_paths_count", 1)
  
      # Analysis cache optimization is enabled (cache writing).
      self.assertMetricsCounterEqual(
          metrics, "analyzer_cache_enabled", 1
      )
  
      # StatsGen is disabled for the test.
      self.assertMetricsCounterEqual(metrics, "disable_statistics", 1)
  
      # Output materialization is enabled.
      self.assertMetricsCounterEqual(metrics, "materialize", 1)
  
      # Estimated stage count is 90 because there are 9 analyzers in the
      # preprocessing_fn and a single span input.
      metric = metrics.query(
          beam.metrics.MetricsFilter().with_name(
              "estimated_stage_count_with_cache"
          )
      )["distributions"]
      self.assertLen(metric, 1)
      self.assertEqual(
          metric[0].committed.sum,
          self._TEST_COUNTERS["metric_committed_sum"],
      )
  
imports: import copy
  import json
  import os
  import re
  import tempfile
  from unittest import mock
  from absl.testing import parameterized
  import apache_beam
  import tensorflow
  import tensorflow_data_validation
  import tensorflow_transform
  from tensorflow_transform.beam import tft_unit
  from tfx import types
  from tfx.components.testdata.module_file import transform_module
  from tfx.components.transform import executor
  from tfx.dsl.io import fileio
  from tfx.proto import example_gen_pb2
  from tfx.proto import transform_pb2
  from tfx.types import artifact_utils
  from tfx.types import standard_artifacts
  from tfx.types import standard_component_specs
  from tfx.utils import io_utils
  from tfx.utils import name_utils
  from tfx.utils import proto_utils
label_desc: Use image node_id 26 for calling the ExecutorTest obj's underlying member method code with example usage: obj.test_counters() without return types