class_docstr: Adapter providing all the base attributes required by a metrics event and defining an interface used by the
  metrics manager when batching and writing events.
class_docstr_tok: ["Adapter","providing","all","the","base","attributes","required","by","a","metrics","event","and","defining","an","interface","used","by","the","metrics","manager","when","batching","and","writing","events","."]
code: def __init__(
      self,
      metric,
      variant,
      iter=None,
      timestamp=None,
      task=None,
      gen_timestamp_if_none=True,
      model_event=None,
  ):
      if not timestamp and gen_timestamp_if_none:
          timestamp = int(time.time() * 1000)
      self._metric = metric
      self._variant = variant
      self._iter = iter
      self._timestamp = timestamp
      self._task = task
      self._model_event = model_event
  
      # Try creating an event just to trigger validation
      _ = self.get_api_event()
      self.upload_exception = None
  
imports: import abc
  import hashlib
  import time
  from functools import reduce
  from logging import getLevelName
  import attr
  import numpy
  import pathlib2
  import six
  from PIL import Image
  from six.moves.urllib.parse import urlparse, urlunparse
  from ...backend_api.services import events
  from ...config import deferred_config
  from ...debugging.log import LoggerRoot
  from ...storage.util import quote_url
  from ...utilities.attrs import attrs
  from ...utilities.process.mp import SingletonLock
label_desc: Use image node_id 4 to create a new MetricsEventAdapter object from inherited base classes: object with example: obj = MetricsEventAdapter(metric, variant, iter, timestamp, task, gen_timestamp_if_none, model_event)