code: def test_logging_failures_are_handled_as_expected():
      experiment_name = "test_run_creation_termination"
      MlflowClient().create_experiment(experiment_name)
      experiment_id = (
          MlflowClient()
          .get_experiment_by_name(experiment_name)
          .experiment_id
      )
  
      with mock.patch(
          "mlflow.utils.autologging_utils.client.MlflowClient.log_batch"
      ) as log_batch_mock:
          log_batch_mock.side_effect = Exception(
              "Batch logging failed!"
          )
  
          client = MlflowAutologgingQueueingClient()
          pending_run_id = client.create_run(
              experiment_id=experiment_id
          )
          client.log_metrics(run_id=pending_run_id, metrics={"a": 1})
          client.set_terminated(run_id=pending_run_id, status="KILLED")
  
          with pytest.raises(
              MlflowException, match="Batch logging failed!"
          ) as exc:
              client.flush()
  
          runs = mlflow.search_runs(
              experiment_ids=[experiment_id], output_format="list"
          )
          assert len(runs) == 1
          run = runs[0]
          # Verify that metrics are absent due to the failure of batch logging
          assert not run.data.metrics
          # Verify that the run termination operation was still performed successfully
          assert run.info.status == "KILLED"
  
          assert (
              f"Failed to perform one or more operations on the run with ID {run.info.run_id}"
              in str(exc.value)
          )
          assert "Batch logging failed!" in str(exc.value)
  
imports: import time
  from unittest import mock
  import pytest
  import mlflow
  from mlflow import MlflowClient
  from mlflow.exceptions import MlflowException
  from mlflow.utils import _truncate_dict
  from mlflow.utils.autologging_utils import MlflowAutologgingQueueingClient
  from mlflow.utils.validation import MAX_ENTITY_KEY_LENGTH, MAX_METRICS_PER_BATCH, MAX_PARAM_VAL_LENGTH, MAX_PARAMS_TAGS_PER_BATCH, MAX_TAG_VAL_LENGTH
label_desc: Use image node_id 12 for calling a global function with example usage: test_logging_failures_are_handled_as_expected() without return types