class_docstr: DataSource describes properties in a benchmark data.
  
  DataSource contains the metadata of a benchmark data including the total
  number of records, the number of partitioned files and a scenario. A scenario
  defines the features used in benchmark with the feature name, tensor spec,
  and Generator used to generate the value. DataSource can be consumed by
  FileWriter to generate the benchmark data descrbied by itself.
docstr: Create a new DataSource.
  
  Args:
    scenario: A dict with feature name as key and Generator as value.
      Scenario defines the features used in benchmark. Generator contains
      tensor spec and the distribution to generate the tensor value.
    num_records: An int defines total number of records in this data.
    partitions: An int defines the number of partitioned files in this data.
      Each partition can have different number of records. However, the total
      number of records must be num_records.
  
  Raises:
    ValueError: If num_records or partitions is negative or partitions is
      zero but num_records is greater than zero.
docstr_tok: ["Create","a","new","DataSource",".","Args",":","scenario",":","A","dict","with","feature","name","as","key","and","Generator","as","value",".","Scenario","defines","the","features","used","in","benchmark",".","Generator","contains","tensor","spec","and","the","distribution","to","generate","the","tensor","value",".","num_records",":","An","int","defines","total","number","of","records","in","this","data",".","partitions",":","An","int","defines","the","number","of","partitioned","files","in","this","data",".","Each","partition","can","have","different","number","of","records",".","However",",","the","total","number","of","records","must","be","num_records",".","Raises",":","ValueError",":","If","num_records","or","partitions","is","negative","or","partitions","is","zero","but","num_records","is","greater","than","zero","."]
code: def __init__(self, scenario, num_records, partitions=1):
      """Create a new DataSource.
  
      Args:
        scenario: A dict with feature name as key and Generator as value.
          Scenario defines the features used in benchmark. Generator contains
          tensor spec and the distribution to generate the tensor value.
        num_records: An int defines total number of records in this data.
        partitions: An int defines the number of partitioned files in this data.
          Each partition can have different number of records. However, the total
          number of records must be num_records.
  
      Raises:
        ValueError: If num_records or partitions is negative or partitions is
          zero but num_records is greater than zero.
      """
      if num_records < 0:
          raise ValueError(
              "Number of records in DataSource must not be negative"
              f" but got {num_records}."
          )
      if partitions < 0:
          raise ValueError(
              "Partition number in DataSource must not be negative"
              f" but got {partitions}."
          )
      if partitions == 0 and num_records > 0:
          raise ValueError(
              "Cannot have zero partitions in DataSource with"
              f"non-zero num_records ({num_records})."
          )
  
      self._scenario = scenario
      self._num_records = num_records
      self._partitions = partitions
  
file_path: io/tests/test_atds_avro/utils/data_source.py
imports: import hashlib
  from tests.test_atds_avro.utils.hash_util import int_to_bytes
label_desc: Use image node_id 1 to create a new DataSource object  with example: obj = DataSource(scenario, num_records, partitions)