code: def _send_records(self, records):
      # if we have previous batch requests first send them
      buffer = []
      for r in records:
          if isinstance(r, events.AddBatchRequest):
              self._send_events(r)
          else:
              buffer.append(r)
  
      # noinspection PyBroadException
      try:
          record_events = [
              r
              for record in buffer
              for r in self._record_to_event(record)
          ] + [self._last_event]
          self._last_event = None
          batch_requests = events.AddBatchRequest(
              requests=[
                  events.AddRequest(e) for e in record_events if e
              ]
          )
          self._send_events(batch_requests)
      except Exception as ex:
          # noinspection PyProtectedMember
          TaskHandler._log_stderr(
              "{}\nWARNING: clearml.log - Failed logging task to backend ({:d} lines)".format(
                  ex, len(buffer)
              )
          )
  
imports: import json
  import sys
  from pathlib2 import Path
  from logging import LogRecord, getLogger, basicConfig, getLevelName, INFO, WARNING, Formatter, makeLogRecord, warning
  from logging.handlers import BufferingHandler
  from .development.worker import DevWorker
  from ...backend_api.services import events
  from ...backend_api.session.session import MaxRequestSizeError
  from ...config import config
  from ...utilities.process.mp import BackgroundMonitor, ForkEvent, ForkQueue
  from ...utilities.process.mp import SafeQueue, SafeEvent
label_desc: Use image node_id 10 for calling the BackgroundLogService obj's underlying member method code with example usage: obj._send_records(records) without return types