code: def on_after_run(self, script_globals):
      from lightning.pytorch import Trainer
      from lightning.pytorch.cli import LightningCLI
  
      for v in script_globals.values():
          if isinstance(v, LightningCLI):
              trainer = v.trainer
              break
          if isinstance(v, Trainer):
              trainer = v
              break
      else:
          raise RuntimeError("No trainer instance found.")
  
      self.monitor = trainer.checkpoint_callback.monitor
  
      if trainer.checkpoint_callback.best_model_score:
          self.best_model_path = Path(
              trainer.checkpoint_callback.best_model_path
          )
          self.best_model_score = float(
              trainer.checkpoint_callback.best_model_score
          )
      else:
          self.best_model_path = Path(
              trainer.checkpoint_callback.last_model_path
          )
  
      self.has_finished = True
  
imports: import os
  from typing import Any, Dict, List, Optional, Tuple, Type, Union
  from lightning.app.components.python import TracerPythonScript
  from lightning.app.core.flow import LightningFlow
  from lightning.app.storage.path import Path
  from lightning.app.structures import List
  from lightning.app.utilities.app_helpers import Logger
  from lightning.app.utilities.packaging.cloud_compute import CloudCompute
label_desc: Use image node_id 4 for calling the PyTorchLightningScriptRunner obj's underlying member method code with example usage: obj.on_after_run(script_globals) without return types