class_docstr: Strategy for how to shard (split) the work.
docstr: Valid ``spec``\s are:
  
  - ``no``: this script performs all necessary work.
  - ``start``: this script creates an output directory for the shards, and
    prints its path."
  - ``<i>/<n>``:, where 0 <= i < n this script only runs benchmarks for shard ``i`` out of
    ``n``, and stores partial results.
  - ``collect``: this script assumes all benchmarks already have been computed, using the
    ``<i>/<n>`` commands, and merges their results into one file.
docstr_tok: ["Valid","``","spec","``","\\s","are",":","-","``","no","``",":","this","script","performs","all","necessary","work",".","-","``","start","``",":","this","script","creates","an","output","directory","for","the","shards",",","and","prints","its","path",".","''","-","``","<","i",">","\/","<","n",">","``",":",",","where","0","<","=","i","<","n","this","script","only","runs","benchmarks","for","shard","``","i","``","out","of","``","n","``",",","and","stores","partial","results",".","-","``","collect","``",":","this","script","assumes","all","benchmarks","already","have","been","computed",",","using","the","``","<","i",">","\/","<","n",">","``","commands",",","and","merges","their","results","into","one","file","."]
code: def __init__(self, spec: str) -> None:
      """
      Valid ``spec``\s are:
  
      - ``no``: this script performs all necessary work.
      - ``start``: this script creates an output directory for the shards, and
        prints its path."
      - ``<i>/<n>``:, where 0 <= i < n this script only runs benchmarks for shard ``i`` out of
        ``n``, and stores partial results.
      - ``collect``: this script assumes all benchmarks already have been computed, using the
        ``<i>/<n>`` commands, and merges their results into one file.
      """
      self.spec = spec
      if spec == "no":
          self.setup_dest = True
          self.print_dest = False
          self.write_metadata = True
          self.run_benchmarks = True
          self.shard_i = 0
          self.shard_n = 1
          self.add_file_suffix = False
          self.collect = False
          self.plot = True
      elif spec == "start":
          self.setup_dest = True
          self.print_dest = True
          self.write_metadata = True
          self.run_benchmarks = False
          self.shard_i = 0
          self.shard_n = 1
          self.add_file_suffix = False
          self.collect = False
          self.plot = False
      elif spec == "collect":
          self.setup_dest = False
          self.print_dest = False
          self.write_metadata = False
          self.run_benchmarks = False
          self.shard_i = 0
          self.shard_n = 1
          self.add_file_suffix = False
          self.collect = True
          self.plot = True
      else:
          i_str, n_str = spec.split("/")
          self.setup_dest = False
          self.print_dest = False
          self.write_metadata = True
          self.run_benchmarks = True
          self.shard_i = int(i_str)
          self.shard_n = int(n_str)
          self.add_file_suffix = True
          self.collect = False
          self.plot = False
      assert not (self.run_benchmarks and self.collect)
      assert 0 <= self.shard_i < self.shard_n, (
          self.shard_i,
          self.shard_n,
      )
  
imports: from pathlib import Path
  from typing import Collection
label_desc: Use image node_id 1 to create a new ShardingStrategy object  with example: obj = ShardingStrategy(spec)