code: def algo_max_runtime_secs():
      """
      This pyunit test is written to ensure that the various model will not crash if the max_runtime_secs
      is set to be too short.  See https://github.com/h2oai/h2o-3/issues/11681.
      """
      global model_within_max_runtime
      seed = 12345
  
      # word2vec
      train = h2o.import_file(
          pyunit_utils.locate("bigdata/laptop/text8.gz"),
          header=1,
          col_types=["string"],
      )
      used = train[0:170000, 0]
      w2v_model = H2OWord2vecEstimator()
      grabRuntimeInfo(w2v_model, used, [], 0)
      cleanUp([train, used, w2v_model])
  
      # kmeans
      training1_data = h2o.import_file(
          path=pyunit_utils.locate(
              "smalldata/gridsearch/kmeans_8_centers_3_coords.csv"
          )
      )
      x_indices = list(range(training1_data.ncol))
      model = H2OKMeansEstimator(k=10)
      grabRuntimeInfo(model, training1_data, x_indices)
      cleanUp([training1_data, model])
  
      # PCA, pca_method=Power
      training1_data = h2o.import_file(
          path=pyunit_utils.locate(
              "smalldata/gridsearch/pca1000by25.csv"
          )
      )
      x_indices = list(range(training1_data.ncol))
      model = H2OPCA(
          k=10,
          transform="STANDARDIZE",
          pca_method="Power",
          compute_metrics=True,
      )
      grabRuntimeInfo(model, training1_data, x_indices)
      cleanUp([model])
  
      # PCA, pca_method=Randomized
      model = H2OPCA(
          k=10,
          transform="STANDARDIZE",
          pca_method="Randomized",
          compute_metrics=True,
      )
      grabRuntimeInfo(model, training1_data, x_indices)
      cleanUp([model])
  
      # PCA, pca_method=GLRM
      model = H2OPCA(
          k=10,
          transform="STANDARDIZE",
          pca_method="GLRM",
          compute_metrics=True,
          use_all_factor_levels=True,
      )
      grabRuntimeInfo(model, training1_data, x_indices)
      cleanUp([model])
  
      # deeplearning
      training1_data = h2o.import_file(
          path=pyunit_utils.locate(
              "smalldata/gridsearch/gaussian_training1_set.csv"
          )
      )
      y_index = training1_data.ncol - 1
      x_indices = list(range(y_index))
      model = H2ODeepLearningEstimator(
          distribution="gaussian", seed=seed, hidden=[10, 10, 10]
      )
      grabRuntimeInfo(model, training1_data, x_indices, y_index)
      cleanUp([training1_data, model])
  
      # stack ensemble, stacking part is not iterative
      print(
          "******************** Skip testing stack ensemble.  Not an iterative algo."
      )
  
      # GBM run
      training1_data = h2o.import_file(
          path=pyunit_utils.locate(
              "smalldata/gridsearch/multinomial_training1_set.csv"
          )
      )
      y_index = training1_data.ncol - 1
      x_indices = list(range(y_index))
      training1_data[y_index] = (
          training1_data[y_index].round().asfactor()
      )
      model = H2OGradientBoostingEstimator(
          distribution="multinomial", seed=seed
      )
      grabRuntimeInfo(model, training1_data, x_indices, y_index)
      cleanUp([model])
  
      # GLM run
      model = H2OGeneralizedLinearEstimator(
          family="multinomial", seed=seed
      )
      grabRuntimeInfo(model, training1_data, x_indices, y_index)
      cleanUp([model])
  
      # naivebayes, not iterative
      print(
          "******************** Skip testing Naives Bayes.  Not an iterative algo."
      )
  
      # random foreset
      model = H2ORandomForestEstimator(
          ntrees=100, score_tree_interval=0
      )
      grabRuntimeInfo(model, training1_data, x_indices)
      cleanUp([model, training1_data])
  
      # GLRM, do not make sense to stop in the middle of an iteration
      training1_data = h2o.import_file(
          path=pyunit_utils.locate(
              "smalldata/gridsearch/glrmdata1000x25.csv"
          )
      )
      x_indices = list(range(training1_data.ncol))
      model = H2OGeneralizedLowRankEstimator(
          k=10,
          loss="Quadratic",
          gamma_x=0.3,
          gamma_y=0.3,
          transform="STANDARDIZE",
          recover_svd=True,
      )
      grabRuntimeInfo(model, training1_data, x_indices)
      cleanUp([training1_data, model])
  
      if sum(model_within_max_runtime) > 0:
          sys.exit(1)
  
file_path: h2o-3/h2o-py/tests/testdir_jira/pyunit_pubdev_4802_short_max_runtime_secs.py
imports: import sys
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.deeplearning import H2ODeepLearningEstimator
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
  from h2o.estimators.glrm import H2OGeneralizedLowRankEstimator
  from h2o.estimators.kmeans import H2OKMeansEstimator
  from h2o.estimators.pca import H2OPrincipalComponentAnalysisEstimator
  from h2o.estimators.random_forest import H2ORandomForestEstimator
  from h2o.estimators.word2vec import H2OWord2vecEstimator
label_desc: Use image node_id 1 for calling a global function with example usage: algo_max_runtime_secs() without return types