class_docstr: The BatchMetricsLogger will log metrics in batch against an mlflow run.
  If run_id is passed to to constructor then all recording and logging will
  happen against that run_id.
  If no run_id is passed into constructor, then the run ID will be fetched
  from `mlflow.active_run()` each time `record_metrics()` or `flush()` is called; in this
  case, callers must ensure that an active run is present before invoking
  `record_metrics()` or `flush()`.
class_docstr_tok: ["The","BatchMetricsLogger","will","log","metrics","in","batch","against","an","mlflow","run",".","If","run_id","is","passed","to","to","constructor","then","all","recording","and","logging","will","happen","against","that","run_id",".","If","no","run_id","is","passed","into","constructor",",","then","the","run","ID","will","be","fetched","from","`","mlflow.active_run","(",")","`","each","time","`","record_metrics","(",")","`","or","`","flush","(",")","`","is","called",";","in","this","case",",","callers","must","ensure","that","an","active","run","is","present","before","invoking","`","record_metrics","(",")","`","or","`","flush","(",")","`","."]
code: def _timed_log_batch(self):
      # Retrieving run_id from active mlflow run when run_id is empty.
      current_run_id = (
          mlflow.active_run().info.run_id
          if self.run_id is None
          else self.run_id
      )
  
      start = time.time()
      metrics_slices = [
          self.data[i : i + MAX_METRICS_PER_BATCH]
          for i in range(0, len(self.data), MAX_METRICS_PER_BATCH)
      ]
      for metrics_slice in metrics_slices:
          self.client.log_batch(
              run_id=current_run_id, metrics=metrics_slice
          )
      end = time.time()
      self.total_log_batch_time += end - start
  
imports: import contextlib
  import inspect
  import logging
  import time
  from typing import List
  import mlflow
  from mlflow.entities import Metric
  from mlflow.tracking.client import MlflowClient
  from mlflow.utils.validation import MAX_METRICS_PER_BATCH
  from mlflow.utils.autologging_utils.client import MlflowAutologgingQueueingClient
  from mlflow.utils.autologging_utils.events import AutologgingEventLogger
  from mlflow.utils.autologging_utils.logging_and_warnings import set_mlflow_events_and_warnings_behavior_globally, set_non_mlflow_warnings_behavior_for_current_thread
  from mlflow.utils.autologging_utils.safety import ExceptionSafeAbstractClass, ExceptionSafeClass, PatchFunction, exception_safe_function_for_class, is_testing, picklable_exception_safe_function, revert_patches, safe_patch, update_wrapper_extended, with_managed_run
  from mlflow.utils.autologging_utils.versioning import FLAVOR_TO_MODULE_NAME_AND_VERSION_INFO_KEY, get_min_max_version_and_pip_release, is_flavor_supported_for_associated_package_versions
label_desc: Use image node_id 3 for calling the BatchMetricsLogger obj's underlying member method code with example usage: obj._timed_log_batch() without return types