code: def test_automl_stops_after_max_runtime_secs():
      print(
          "Check that automl gets interrupted after `max_runtime_secs`"
      )
      max_runtime_secs = 30
      cancel_tolerance_secs = (
          5 + 5
      )  # should work for most cases given current mechanism, +5 due to SE which currently ignore max_runtime_secs
      ds = import_dataset()
      aml = H2OAutoML(
          project_name="py_aml_max_runtime_secs",
          seed=1,
          max_runtime_secs=max_runtime_secs,
      )
      start = time.time()
      aml.train(y=ds.target, training_frame=ds.train)
      end = time.time()
      assert (
          abs(end - start - max_runtime_secs) < cancel_tolerance_secs
      ), (end - start)
  
imports: import sys, os, time
  from tests import pyunit_utils
  from h2o.automl import H2OAutoML
  from _automl_utils import import_dataset
label_desc: Use image node_id 1 for calling a global function with example usage: test_automl_stops_after_max_runtime_secs() without return types