code: def main(args):
      init_logging()
  
      records = []
  
      def handler(stats):
          records.append(stats)
  
      data_dir = (
          args.data_dir
          or os.environ.get("HAIL_BENCHMARK_DIR")
          or "/tmp/hail_benchmark_data"
      )
      profiler_path = os.environ.get("ASYNC_PROFILER_HOME")
  
      if args.profile and profiler_path is None:
          raise KeyError(
              "In order to use --profile, you must download async-profiler and set `ASYNC_PROFILER_HOME`"
          )
  
      config = RunConfig(
          args.n_iter,
          handler,
          noisy=not args.quiet,
          timeout=args.timeout,
          dry_run=args.dry_run,
          data_dir=data_dir,
          cores=args.cores,
          verbose=args.verbose,
          log=args.log,
          profiler_path=profiler_path,
          profile=args.profile,
          prof_fmt=args.prof_fmt,
      )
      if args.tests:
          run_list(args.tests.split(","), config)
      if args.pattern:
          run_pattern(args.pattern, config)
      if not args.pattern and not args.tests:
          run_all(config)
  
      if args.dry_run:
          return
  
      data = {
          "config": {
              "cores": args.cores,
              "version": hl.__version__,
              "timestamp": str(datetime.datetime.now()),
              "system": sys.platform,
          },
          "benchmarks": records,
      }
      if args.output:
          with open(args.output, "w") as out:
              json.dump(data, out)
      else:
          print(json.dumps(data))
  
file_path: hail/benchmark/python/benchmark_hail/run/cli.py
imports: import argparse
  import datetime
  import json
  import os
  import sys
  import hail
  from .utils import run_all, run_pattern, run_list, RunConfig
  from ..None import init_logging
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) without return types