code: def test_autologging_does_not_throw_on_api_failures(
      spark_session, format_to_file_path, tmp_path
  ):
      mlflow.spark.autolog()
      with _init_server(
          f"sqlite:///{tmp_path}/test.db",
          root_artifact_uri=tmp_path.as_uri(),
      ) as url:
          mlflow.set_tracking_uri(url)
          with mlflow.start_run():
              with mock.patch(
                  "mlflow.utils.rest_utils.http_request",
                  side_effect=Exception("API request failed!"),
              ):
                  data_format = list(format_to_file_path.keys())[0]
                  file_path = format_to_file_path[data_format]
                  df = (
                      spark_session.read.format(data_format)
                      .option("header", "true")
                      .option("inferSchema", "true")
                      .load(file_path)
                  )
                  df.collect()
                  df.filter("number1 > 0").collect()
                  df.limit(2).collect()
                  df.collect()
                  time.sleep(1)
  
file_path: mlflow/tests/spark/autologging/datasource/test_spark_datasource_autologging.py
imports: import time
  from unittest import mock
  from pyspark.sql import Row
  from pyspark.sql.types import IntegerType, StructField, StructType
  import mlflow
  import mlflow.spark
  from mlflow._spark_autologging import _SPARK_TABLE_INFO_TAG_NAME
  from mlflow.utils.validation import MAX_TAG_VAL_LENGTH
  from tests.spark.autologging.utils import _assert_spark_data_logged
  from tests.tracking.integration_test_utils import _init_server
label_desc: Use image node_id 3 for calling a global function with example usage: test_autologging_does_not_throw_on_api_failures(spark_session, format_to_file_path, tmp_path) without return types