code: def extract_failed_tests_info():
      """
      This method will scrape the console output for pyunit,runit and hadoop runs and grab the list of failed tests
      and their corresponding paths so that the test execution summary can be located later.
  
      :return: none
      """
      global g_failed_testnames
      global g_failed_test_paths
  
      if os.path.isfile(g_temp_filename):
          console_file = open(
              g_temp_filename, "r"
          )  # open temp file that stored jenkins job console output
          try:
              for (
                  each_line
              ) in (
                  console_file
              ):  # go through each line of console output to extract build ID, data/time ...
                  each_line.strip()
                  print(each_line)
                  if ("Test Result" in each_line) and (
                      "failure" in each_line
                  ):  # the next few lines will contain failed tests
                      temp = each_line.split("testReport")
                      if ("Test Result" in temp[1]) and (
                          "failure" in temp[1]
                      ):  # grab number of failed tests
                          try:
                              tempCount = int(
                                  temp[1]
                                  .split("</a>")[1]
                                  .split(" ")[0]
                                  .split("(")[1]
                              )
  
                              if (
                                  isinstance(tempCount, int)
                                  and tempCount > 0
                              ):  # temp[1], temp[2],... should contain failed tests
                                  for findex in range(2, len(temp)):
                                      tempMess = temp[findex].split(">")
                                      g_failed_test_paths.append(
                                          tempMess[0].strip('"')
                                      )
                                      ftestname = tempMess[1].strip(
                                          "</a"
                                      )
                                      nameLen = len(ftestname)
                                      true_testname = (
                                          ftestname[8:nameLen]
                                          if "r_suite." in ftestname
                                          else ftestname
                                      )
                                      g_failed_testnames.append(
                                          true_testname
                                      )
                                  break  # done.  Only one spot contains failed test info.
                          except:
                              break  # file probably does not have failures captured.
          finally:
              console_file.close()
  
file_path: h2o-3/scripts/scrapeForIntermittents.py
imports: import sys
  import os
  import json
  import subprocess
  import time
  import datetime
  from pytz import timezone
  from dateutil import parser
label_desc: Use image node_id 5 for calling a global function with example usage: extract_failed_tests_info() without return types