code: def run_commands(command, number_to_run, temp_file):
      """
      This function will run the command for number_to_run number of times.  For each run,
      it will capture the run time for the unit test and will move on to the next test if
      it takes too long to run this one.
  
      :param command: string containing the command to be run
      :param number_to_run: integer denoting the number of times to run command
      :param temp_file: string containing file name to store run command output
  
      :return: None
      """
      global g_max_runtime_secs
      global g_finished_this_unit_test
  
      temp_string = command.split()
      testname = temp_string[-1]
      temp_string = testname.split("/")
  
      full_command = command + " > " + temp_file
      g_finished_this_unit_test = False
  
      for run_index in range(0, number_to_run):
          if g_finished_this_unit_test:
              break
  
          child = subprocess.Popen(full_command, shell=True)
  
          while child.poll() is None:
              time.sleep(20)
          #        subprocess.call(full_command, shell=True)   # run the command,
  
          with open(
              temp_file, "r"
          ) as thefile:  # go into tempfile and grab test run info
              for each_line in thefile:
                  temp_string = each_line.split()
                  if len(temp_string) > 0:
                      if temp_string[0] == "PASS":
                          test_time = temp_string[2]
                          try:
                              runtime = float(test_time[:-1])
  
                              print(
                                  "Unit test run time is {0}".format(
                                      runtime
                                  )
                              )
                              if runtime > g_max_runtime_secs:
                                  g_finished_this_unit_test = True
  
                          except:
                              print(
                                  "Cannot convert run time.  It is {0}\n".format(
                                      runtime
                                  )
                              )
                          break
  
imports: import sys
  import os
  import json
  import subprocess
  import time
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: run_commands(command, number_to_run, temp_file) without return types