class_docstr: The ``Logger`` class is the ClearML console log and metric statistics interface, and contains methods for explicit
  reporting.
  
  Explicit reporting extends ClearML automagical capturing of inputs and output. Explicit reporting
  methods include scalar plots, line plots, histograms, confusion matrices, 2D and 3D scatter
  diagrams, text logging, tables, and image uploading and reporting.
  
  In the **ClearML Web-App (UI)**, ``Logger`` output appears in the **RESULTS** tab, **CONSOLE**, **SCALARS**,
  **PLOTS**, and **DEBUG SAMPLES** sub-tabs. When you compare experiments, ``Logger`` output appears in the
  comparisons.
  
  .. warning::
  
     Do not construct Logger objects directly.
  
  You must get a Logger object before calling any of the other ``Logger`` class methods by calling
  :meth:`.Task.get_logger` or :meth:`Logger.current_logger`.
class_docstr_tok: ["The","``","Logger","``","class","is","the","ClearML","console","log","and","metric","statistics","interface",",","and","contains","methods","for","explicit","reporting",".","Explicit","reporting","extends","ClearML","automagical","capturing","of","inputs","and","output",".","Explicit","reporting","methods","include","scalar","plots",",","line","plots",",","histograms",",","confusion","matrices",",","2D","and","3D","scatter","diagrams",",","text","logging",",","tables",",","and","image","uploading","and","reporting",".","In","the","*","*","ClearML","Web-App","(","UI",")","*","*",",","``","Logger","``","output","appears","in","the","*","*","RESULTS","*","*","tab",",","*","*","CONSOLE","*","*",",","*","*","SCALARS","*","*",",","*","*","PLOTS","*","*",",","and","*","*","DEBUG","SAMPLES","*","*","sub-tabs",".","When","you","compare","experiments",",","``","Logger","``","output","appears","in","the","comparisons",".","..","warning",":",":","Do","not","construct","Logger","objects","directly",".","You","must","get","a","Logger","object","before","calling","any","of","the","other","``","Logger","``","class","methods","by","calling",":","meth",":","`",".Task.get_logger","`","or",":","meth",":","`","Logger.current_logger","`","."]
docstr: Report media upload its contents, including images, audio, and video.
  
  Media is uploaded to a preconfigured bucket (see setup_upload()) with a key (filename)
  describing the task ID, title, series and iteration.
  
  One and only one of the following parameters must be provided
  
  - ``local_path``
  - ``stream``
  - ``url``
  
  If you use ``stream`` for a BytesIO stream to upload, ``file_extension`` must be provided.
  
  :param str title: The title (metric) of the media.
  :param str series: The series name (variant) of the reported media.
  :param int iteration: The reported iteration / step.
  :param str local_path: A path to a media file.
  :param stream: BytesIO stream to upload. If provided, ``file_extension`` must also be provided.
  :param str url: A URL to the location of a pre-uploaded media.
  :param file_extension: A file extension to use when ``stream`` is passed.
  :param int max_history: The maximum number of media files to store per metric/variant combination.
      Use negative value for unlimited. Default is set in global configuration (default=5)
  :param bool delete_after_upload: After the file is uploaded, delete the local copy
  
      - ``True`` - Delete
      - ``False`` - Do not delete
docstr_tok: ["Report","media","upload","its","contents",",","including","images",",","audio",",","and","video",".","Media","is","uploaded","to","a","preconfigured","bucket","(","see","setup_upload","(",")",")","with","a","key","(","filename",")","describing","the","task","ID",",","title",",","series","and","iteration",".","One","and","only","one","of","the","following","parameters","must","be","provided","-","``","local_path","``","-","``","stream","``","-","``","url","``","If","you","use","``","stream","``","for","a","BytesIO","stream","to","upload",",","``","file_extension","``","must","be","provided",".",":","param","str","title",":","The","title","(","metric",")","of","the","media",".",":","param","str","series",":","The","series","name","(","variant",")","of","the","reported","media",".",":","param","int","iteration",":","The","reported","iteration","\/","step",".",":","param","str","local_path",":","A","path","to","a","media","file",".",":","param","stream",":","BytesIO","stream","to","upload",".","If","provided",",","``","file_extension","``","must","also","be","provided",".",":","param","str","url",":","A","URL","to","the","location","of","a","pre-uploaded","media",".",":","param","file_extension",":","A","file","extension","to","use","when","``","stream","``","is","passed",".",":","param","int","max_history",":","The","maximum","number","of","media","files","to","store","per","metric\/variant","combination",".","Use","negative","value","for","unlimited",".","Default","is","set","in","global","configuration","(","default=5",")",":","param","bool","delete_after_upload",":","After","the","file","is","uploaded",",","delete","the","local","copy","-","``","True","``","-","Delete","-","``","False","``","-","Do","not","delete"]
code: def report_media(
      self,
      title,  # type: str
      series,  # type: str
      iteration=None,  # type: Optional[int]
      local_path=None,  # type: Optional[str]
      stream=None,  # type: Optional[Union[six.BytesIO, six.StringIO]]
      file_extension=None,  # type: Optional[str]
      max_history=None,  # type: Optional[int]
      delete_after_upload=False,  # type: bool
      url=None,  # type: Optional[str]
  ):
      """
      Report media upload its contents, including images, audio, and video.
  
      Media is uploaded to a preconfigured bucket (see setup_upload()) with a key (filename)
      describing the task ID, title, series and iteration.
  
      One and only one of the following parameters must be provided
  
      - ``local_path``
      - ``stream``
      - ``url``
  
      If you use ``stream`` for a BytesIO stream to upload, ``file_extension`` must be provided.
  
      :param str title: The title (metric) of the media.
      :param str series: The series name (variant) of the reported media.
      :param int iteration: The reported iteration / step.
      :param str local_path: A path to a media file.
      :param stream: BytesIO stream to upload. If provided, ``file_extension`` must also be provided.
      :param str url: A URL to the location of a pre-uploaded media.
      :param file_extension: A file extension to use when ``stream`` is passed.
      :param int max_history: The maximum number of media files to store per metric/variant combination.
          Use negative value for unlimited. Default is set in global configuration (default=5)
      :param bool delete_after_upload: After the file is uploaded, delete the local copy
  
          - ``True`` - Delete
          - ``False`` - Do not delete
  
      """
      mutually_exclusive(
          UsageError,
          _check_none=True,
          local_path=local_path or None,
          url=url or None,
          stream=stream,
      )
      if stream is not None and not file_extension:
          raise ValueError(
              "No file extension provided for stream media upload"
          )
  
      # if task was not started, we have to start it
      self._start_task_if_needed()
  
      self._touch_title_series(title, series)
  
      if url:
          # noinspection PyProtectedMember
          self._task._reporter.report_media(
              title=title,
              series=series,
              src=url,
              iter=iteration or 0,
          )
  
      else:
          upload_uri = self.get_default_upload_destination()
          if not upload_uri:
              upload_uri = Path(get_cache_dir()) / "debug_images"
              upload_uri.mkdir(parents=True, exist_ok=True)
              # Verify that we can upload to this destination
              upload_uri = str(upload_uri)
              storage = StorageHelper.get(upload_uri)
              upload_uri = storage.verify_upload(folder_uri=upload_uri)
          # noinspection PyProtectedMember
          self._task._reporter.report_media_and_upload(
              title=title,
              series=series,
              path=local_path,
              stream=stream,
              iter=iteration or 0,
              upload_uri=upload_uri,
              max_history=max_history
              if max_history is not None
              else self._default_max_sample_history,
              delete_after_upload=delete_after_upload,
              file_extension=file_extension,
          )
  
imports: import logging
  import math
  import warnings
  from typing import Any, Sequence, Union, List, Optional, Tuple, Dict, TYPE_CHECKING
  import numpy
  import six
  from PIL import Image
  from pathlib2 import Path
  from .debugging.log import LoggerRoot
  from .backend_interface.logger import StdStreamPatch
  from .backend_interface.task import Task
  from .backend_interface.task.log import TaskHandler
  from .backend_interface.util import mutually_exclusive
  from .backend_interface.metrics.events import UploadEvent, MetricsEventAdapter
  from .config import running_remotely, get_cache_dir, config, DEBUG_SIMULATE_REMOTE_TASK, deferred_config
  from .errors import UsageError
  from .storage.helper import StorageHelper
  from .utilities.plotly_reporter import SeriesInfo
label_desc: Use image node_id 16 for calling the Logger obj's underlying member method code with example usage: obj.report_media(title, series, iteration, local_path, stream, file_extension, max_history, delete_after_upload, url) without return types