code: def test_random_grid_search_for_glm():
      """
      Create and instantiate classes, call test methods to test randomize grid search for GLM Gaussian
      or Binomial families.
  
      :return: None
      """
      # randomize grid search for Gaussian
      test_glm_gaussian_random_grid = Test_glm_random_grid_search(
          "gaussian"
      )
      test_glm_gaussian_random_grid.test1_glm_random_grid_search_model_number(
          "mse(xval=True)"
      )  # this test must be run.
      test_glm_gaussian_random_grid.test2_glm_random_grid_search_max_model()
      test_glm_gaussian_random_grid.test3_glm_random_grid_search_max_runtime_secs()
      test_glm_gaussian_random_grid.test4_glm_random_grid_search_metric(
          "MSE", False
      )
      #    test_glm_gaussian_random_grid.test4_glm_random_grid_search_metric("r2", True)  # R2 was removed as a stopping metric
      # test_glm_gaussian_random_grid.tear_down()  # obsolete
  
      # exit with error if any tests have failed
      if test_glm_gaussian_random_grid.test_failed > 0:
          sys.exit(1)
      else:
          pyunit_utils.remove_files(
              os.path.join(
                  test_glm_gaussian_random_grid.current_dir,
                  test_glm_gaussian_random_grid.json_filename,
              )
          )
  
file_path: h2o-3/h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py
imports: import sys
  import random
  import os
  from builtins import range
  import time
  import json
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
  from h2o.grid.grid_search import H2OGridSearch
label_desc: Use image node_id 1 for calling a global function with example usage: test_random_grid_search_for_glm() without return types