class_docstr: Test that we can capture a large amount of log messages with
  accurate timings
code: def check_results(self, flow, checker):
      from itertools import groupby
      from datetime import datetime
  
      ISOFORMAT = "%Y-%m-%dT%H:%M:%S.%f"
  
      _val = lambda n: list(checker.artifact_dict("end", n).values())[
          0
      ][n]
  
      step_name = _val("log_step")
      num_foreach = _val("num_foreach")
      num_lines = _val("num_lines")
      random_log_prefix = _val("random_log_prefix")
      run = checker.get_run()
  
      for stream in ("stdout", "stderr"):
          log = checker.get_log(step_name, stream)
  
          # ignore event_logger noise and Batch/Lambda noise by only looking at
          # log lines with the random prefix (generated by the very first step)
          lines = [
              line.split()
              for line in log.splitlines()
              if line.startswith(random_log_prefix)
          ]
  
          assert_equals(len(lines), num_foreach * num_lines)
  
          for task_id, task_lines_iter in groupby(
              lines, lambda x: x[1]
          ):
              task_lines = list(task_lines_iter)
              assert_equals(len(task_lines), num_lines)
  
              for i, (_, _, stream_type, idx, tstamp) in enumerate(
                  task_lines
              ):
                  # test that loglines originate from the correct stream
                  # and are properly ordered
                  assert_equals(stream_type, stream)
                  assert_equals(int(idx), i)
  
          if run is not None:
              for task in run[step_name]:
                  # test task.loglines
                  task_lines = [
                      (tstamp, msg)
                      for tstamp, msg in task.loglines(stream)
                      if msg.startswith(random_log_prefix)
                  ]
                  assert_equals(len(task_lines), num_lines)
                  for i, (mf_tstamp, msg) in enumerate(task_lines):
                      (
                          _,
                          task_id,
                          stream_type,
                          idx,
                          tstamp_str,
                      ) = msg.split()
  
                      assert_equals(task_id, task.id)
                      assert_equals(stream_type, stream)
                      assert_equals(int(idx), i)
  
file_path: metaflow/test/core/tests/large_mflog.py
imports: from metaflow_test import MetaflowTest, ExpectationFailed, steps
label_desc: Use image node_id 6 for calling the LargeMflogTest obj's underlying member method code with example usage: obj.check_results(flow, checker) without return types