class_docstr: Collects metrics and sends them directly to metrics service.
class_docstr_tok: ["Collects","metrics","and","sends","them","directly","to","metrics","service","."]
docstr: Closes the metric file.
docstr_tok: ["Closes","the","metric","file","."]
code: def close(self):
      """Closes the metric file."""
      logging.debug("Closing")
      for q in self._metric_queues.values():
          q.close()
  
      # TODO should probably use join
      while any(
          map(lambda x: x.is_active(), self._metric_queues.values())
      ):
          time.sleep(self._COMPLETE_SLEEP_SECONDS)
      logging.debug("Closed")
  
imports: from __future__ import absolute_import
  import datetime
  import logging
  import os
  import time
  import threading
  import queue
  import dateutil.tz
  from sagemaker.session import Session
label_desc: Use image node_id 3 for calling the _AsyncMetricsSink obj's underlying member method code with example usage: obj.close() without return types