code: def test_max_runtime_secs_can_be_set_in_combination_with_max_models_and_max_models_wins():
      ds = import_dataset()
      aml = H2OAutoML(
          project_name="py_all_stopping_constraints",
          seed=1,
          max_models=1,
          max_runtime_secs=1200,
      )
      aml.train(y=ds.target, training_frame=ds.train)
      max_runtime = aml._build_resp["build_control"][
          "stopping_criteria"
      ]["max_runtime_secs"]
      max_models = aml._build_resp["build_control"][
          "stopping_criteria"
      ]["max_models"]
      assert max_runtime == 1200
      assert max_models == 1
      assert aml.leaderboard.nrows == 1
      assert int(aml.training_info["duration_secs"]) < max_runtime / 2
  
file_path: h2o-3/h2o-py/tests/testdir_algos/automl/pyunit_automl_early_stopping.py
imports: import sys, os
  from h2o.exceptions import H2OJobCancelled
  from h2o.automl import H2OAutoML
  from tests import pyunit_utils
  from _automl_utils import import_dataset, get_partitioned_model_names
label_desc: Use image node_id 6 for calling a global function with example usage: test_max_runtime_secs_can_be_set_in_combination_with_max_models_and_max_models_wins() without return types