code: def test_tf_keras_parallel(
      aggregation_frequency: int,
      collect_trial_profiles: Callable[[int], None],
  ) -> None:
      config = conf.load_config(
          conf.cv_examples_path("iris_tf_keras/const.yaml")
      )
      config = conf.set_slots_per_trial(config, 8)
      config = conf.set_max_length(config, {"batches": 200})
      config = conf.set_aggregation_frequency(
          config, aggregation_frequency
      )
      config = conf.set_tf2_image(config)
      config = conf.set_profiling_enabled(config)
  
      experiment_id = exp.run_basic_test_with_temp_config(
          config, conf.cv_examples_path("iris_tf_keras"), 1
      )
      trials = exp.experiment_trials(experiment_id)
      assert len(trials) == 1
  
      # Test exporting a checkpoint.
      export_and_load_model(experiment_id)
      collect_trial_profiles(trials[0].trial.id)
  
      # Check on record/batch counts we emitted in logs.
      validation_size = 30
      global_batch_size = config["hyperparameters"]["global_batch_size"]
      num_workers = config.get("resources", {}).get(
          "slots_per_trial", 1
      )
      global_batch_size = config["hyperparameters"]["global_batch_size"]
      scheduling_unit = config.get("scheduling_unit", 100)
      per_slot_batch_size = global_batch_size // num_workers
      exp_val_batches = (
          validation_size + (per_slot_batch_size - 1)
      ) // per_slot_batch_size
      patterns = [
          # Expect two copies of matching training reports.
          f"trained: {scheduling_unit * global_batch_size} records.*in {scheduling_unit} batches",
          f"trained: {scheduling_unit * global_batch_size} records.*in {scheduling_unit} batches",
          f"validated: {validation_size} records.*in {exp_val_batches} batches",
      ]
      exp.assert_patterns_in_trial_logs(trials[0].trial.id, patterns)
  
file_path: determined/e2e_tests/tests/experiment/test_tf_keras.py
imports: import multiprocessing
  from typing import Callable
  import pytest
  from determined import keras
  from determined.experimental import client
  from tests import config
  from tests import experiment
label_desc: Use image node_id 3 for calling a global function with example usage: test_tf_keras_parallel(aggregation_frequency, collect_trial_profiles) without return types