class_docstr: Metrics manager and batch writer 
class_docstr_tok: ["Metrics","manager","and","batch","writer"]
code: def __init__(
      self,
      session,
      task,
      storage_uri,
      storage_uri_suffix="metrics",
      iteration_offset=0,
      log=None,
      for_model=False,
  ):
      super(Metrics, self).__init__(session, log=log)
      self._task_id = task.id
      self._task_iteration_offset = iteration_offset
      self._storage_uri = (
          storage_uri.rstrip("/") if storage_uri else None
      )
      self._storage_key_prefix = (
          storage_uri_suffix.strip("/") if storage_uri_suffix else None
      )
      self._file_related_event_time = None
      self._file_upload_time = None
      self._offline_log_filename = None
      self._for_model = for_model
      if self._offline_mode:
          offline_folder = Path(task.get_offline_mode_folder())
          offline_folder.mkdir(parents=True, exist_ok=True)
          self._offline_log_filename = (
              offline_folder / self.__offline_filename
          )
  
imports: import json
  import os
  from functools import partial
  from logging import warning
  from multiprocessing.pool import ThreadPool
  from time import time
  from pathlib2 import Path
  from ...backend_api import Session
  from ...backend_api.services import events
  from ..base import InterfaceBase
  from ...config import config, deferred_config
  from ...debugging import get_logger
  from ...storage.helper import StorageHelper
  from .events import MetricsEventAdapter
  from ...utilities.process.mp import SingletonLock
label_desc: Use image node_id 4 to create a new Metrics object from inherited base classes: InterfaceBase with example: obj = Metrics(session, task, storage_uri, storage_uri_suffix, iteration_offset, log, for_model)