code: def test_trial_heartbeat_not_updated(exp, trial):
      """Test that the heartbeat of a trial is not updated when trial is not longer reserved."""
      storage = setup_storage()
  
      trial_monitor = TrialPacemaker(
          trial, wait_time=1, storage=storage
      )
  
      trial_monitor.start()
      time.sleep(2)
  
      trials = exp.fetch_trials_by_status("reserved")
  
      assert trial.heartbeat != trials[0].heartbeat
  
      setup_storage().set_trial_status(trial, status="interrupted")
  
      time.sleep(2)
  
      # `join` blocks until all thread have finish executing. So, the test will hang if it fails.
      trial_monitor.join()
      assert 1
  
file_path: orion/tests/unittests/core/worker/test_trial_pacemaker.py
imports: import datetime
  import time
  import pytest
  import orion.core.io.experiment_builder
  from orion.core.utils.format_trials import tuple_to_trial
  from orion.core.worker.trial_pacemaker import TrialPacemaker
  from orion.storage.base import setup_storage
label_desc: Use image node_id 5 for calling a global function with example usage: test_trial_heartbeat_not_updated(exp, trial) without return types