code: def test_monitor_callbacks(ray_start_4_cpus):
      # Test Callbacks involving logging (SpeedMonitor, LRMonitor)
      from composer.callbacks import LRMonitor, SpeedMonitor
  
      from ray.train.mosaic import MosaicTrainer
  
      trainer_init_config = {
          "max_duration": "1ep",
          "should_eval": True,
      }
      trainer_init_config["log_keys"] = [
          "grad_l2_norm/step",
      ]
      trainer_init_config["callbacks"] = [
          SpeedMonitor(window_size=3),
          LRMonitor(),
      ]
  
      trainer = MosaicTrainer(
          trainer_init_per_worker=trainer_init_per_worker,
          trainer_init_config=trainer_init_config,
          scaling_config=scaling_config,
      )
  
      result = trainer.fit()
  
      assert len(result.metrics_dataframe) == 1
  
      metrics_columns = result.metrics_dataframe.columns
      columns_to_check = [
          "wall_clock/train",
          "wall_clock/val",
          "wall_clock/total",
          "lr-DecoupledSGDW/group0",
      ]
      for column in columns_to_check:
          assert column in metrics_columns, column + " is not found"
          assert result.metrics_dataframe[column].isnull().sum() == 0, (
              column + " column has a null value"
          )
  
file_path: ray/python/ray/train/tests/test_mosaic_trainer.py
imports: import os
  import pytest
  import torch
  import torch.utils.data
  import torchvision
  from filelock import FileLock
  from torchvision import datasets, transforms
  import ray.train
  from ray.train import ScalingConfig
  from ray.train.trainer import TrainingFailedError
label_desc: Use image node_id 6 for calling a global function with example usage: test_monitor_callbacks(ray_start_4_cpus) without return types