code: def extractResultsFromLogs():
      # This file merges together all the results
      dirs = sorted(os.listdir("."))
  
      allFails = []
      allResults = []
  
      for dir in dirs:
          if "run" not in dir:
              continue
          if os.path.exists(os.path.join(dir, "hypermax", "nohup.out")):
              with open(
                  os.path.join(dir, "hypermax", "nohup.out"), "rt"
              ) as file:
                  text = file.read()
  
                  fails = []
                  results = []
  
                  # Extract each of the results out of the log files
                  start = text.find("{")
                  while start != -1:
                      end = text.find("}", start)
                      result = text[start : end + 1]
                      result = result.replace("'", '"')
                      result = result.replace("None", "null")
                      try:
                          data = json.loads(result)
                          data["run"] = dir
                          results.append(preprocessResult(data))
                      except Exception:
                          fails.append(result)
                          # traceback.print_exc()
                      start = text.find("{", end)
  
                  allResults = allResults + results
                  allFails = allFails + fails
      return allResults
  
file_path: hypermax/research/atpe_research_2/process_results.py
imports: import os.path
  import json
  import traceback
  import csv
  import copy
  import sklearn.preprocessing
  import sklearn.neighbors
  import random
  import pickle
  import lightgbm
  import numpy
  from pprint import pprint
  from simulation import AlgorithmSimulation
label_desc: Use image node_id 3 for calling a global function with example usage: extractResultsFromLogs() and returns: allResults