docstr: Generate benchmark data and write the data under the given path.
  
  Args:
    dir_path: A str path to write files to.
    data_source: A DataSource objects.
  
  Raises:
    NotImplementedError: If subclass does not overload the function.
docstr_tok: ["Generate","benchmark","data","and","write","the","data","under","the","given","path",".","Args",":","dir_path",":","A","str","path","to","write","files","to",".","data_source",":","A","DataSource","objects",".","Raises",":","NotImplementedError",":","If","subclass","does","not","overload","the","function","."]
code: def _write_to_path(self, dir_path, data_source):
      """Generate benchmark data and write the data under the given path.
  
      Args:
        dir_path: A str path to write files to.
        data_source: A DataSource objects.
  
      Raises:
        NotImplementedError: If subclass does not overload the function.
      """
      scenario = data_source.scenario
      schema = parse(self.scenario_to_avro_schema(scenario))
  
      filenames_to_num_records = self._get_filenames_to_num_records(
          data_source
      )
      for filename in sorted(filenames_to_num_records):
          file_path = os.path.join(dir_path, filename)
          num_records = filenames_to_num_records[filename]
  
          with open(file_path, "wb") as out:
              file_writer = DataFileWriter(
                  out, DatumWriter(), schema, codec=self._codec
              )
              for _ in range(num_records):
                  features = {}
                  for feature_name in scenario:
                      generator = scenario[feature_name]
                      tensor = generator.generate()
                      self._add_tensor_to_features(
                          generator, feature_name, tensor, features
                      )
                  file_writer.append(features)
              file_writer.close()
  
imports: import os
  import hashlib
  import json
  import numpy
  import tensorflow
  from avro.schema import Parse
  from avro.datafile import DataFileWriter
  from avro.io import DatumWriter
  from tests.test_atds_avro.utils.file_writer import FileWriter
  from tests.test_atds_avro.utils.generator.varlen_tensor_generator import VarLenTensorGeneratorBase
  from tensorflow_io.python.experimental.atds.features import DenseFeature, SparseFeature, VarlenFeature
label_desc: Use image node_id 5 for calling the ATDSWriter obj's underlying member method code with example usage: obj._write_to_path(dir_path, data_source) without return types