class_docstr: This class represents a single execution of a model with a given set of hyper-parameters. It takes care of
  of managing the model process and standardizing the results.
class_docstr_tok: ["This","class","represents","a","single","execution","of","a","model","with","a","given","set","of","hyper-parameters",".","It","takes","care","of","of","managing","the","model","process","and","standardizing","the","results","."]
docstr: Run the model, return the results.
  
  :return: A standard 'results' object.
docstr_tok: ["Run","the","model",",","return","the","results",".",":","return",":","A","standard","'results","'","object","."]
code: def run(self):
      """
      Run the model, return the results.
  
      :return: A standard 'results' object.
      """
      # print("Running: ", parameters)
      if "func" in self.config:
          return self.config["func"](self.parameters)
  
      if (
          self.config["type"] == "python_function"
          or self.config["type"] == "remote"
      ):
          process = self.startSubprocess()
          output = ""
          while (
              process.returncode is None
              and (
                  not self.scriptToken or self.scriptToken not in output
              )
              and "no process found" not in output
          ):
              process.poll()
              nextChars = str(process.stdout.read(), "utf8")
              for nextChar in nextChars:
                  if nextChar == chr(127):
                      output = output[
                          :-1
                      ]  # Erase the last character from the output.
                  else:
                      output += nextChar
              # print(output)
              try:
                  if self.shouldKillProcess():
                      self.killed = True
                      parent = psutil.Process(process.pid)
                      children = parent.children(recursive=True)
                      children.append(parent)
                      for p in children:
                          p.send_signal(9)
              except psutil.NoSuchProcess:
                  pass
              time.sleep(0.002)
  
          if self.killed:
              output += str(process.stdout.read(), "utf8")
              self.result = {
                  "status": "fail",
                  "loss": self.config["auto_kill_loss"],
                  "log": output,
                  "error": "Model was automatically killed.",
                  "time": (
                      datetime.datetime.now() - self.startTime
                  ).total_seconds(),
              }
              self.process = None
              return self.result
  
          output += str(process.stdout.read(), "utf8")
          # print(output)
  
          if self.config["type"] == "python_function":
              cutoffIndex = output.find(self.scriptToken)
          else:
              # The cutoff is the last newline character for a non-empty line
              cutoffIndex = output.rfind("\n")
              while cutoffIndex != -1 and (
                  not output[cutoffIndex:].strip()
              ):
                  cutoffIndex = output.rfind("\n", 0, cutoffIndex - 1)
              if cutoffIndex == -1:
                  cutoffIndex = 0
  
              self.scriptToken = ""
  
          if cutoffIndex == -1:
              self.result = {
                  "status": "fail",
                  "loss": None,
                  "log": output,
                  "error": "Did not find result object in the output from the model script.",
              }
              self.process = None
              return self.result
          else:
              resultString = output[
                  cutoffIndex + len(self.scriptToken) :
              ]
              resultString = resultString.replace("'", '"')
              try:
                  rawResult = json.loads(resultString)
                  self.result = self.interpretResultObject(rawResult)
                  self.result["status"] = "ok"
                  self.result["log"] = output[:cutoffIndex]
                  self.result["error"] = None
                  self.process = None
                  return self.result
              except json.JSONDecodeError as e:
                  self.result = {
                      "status": "fail",
                      "loss": None,
                      "log": output,
                      "error": "Unable to decode the JSON result object from the model.",
                  }
                  self.process = None
                  return self.result
      if self.config["type"] == "remote":
          pass
  
file_path: hypermax/hypermax/execution.py
imports: import subprocess
  import json
  import atexit
  import jsonschema
  import psutil
  import sys
  import random
  import time
  import datetime
  import os
label_desc: Use image node_id 7 for calling the Execution obj's underlying member method code with example usage: obj.run() and returns: self, self, self, self, self