code: def test_run_databricks_cancel(
      before_run_validations_mock,
      runs_submit_mock,
      dbfs_mocks,
      set_tag_mock,
      runs_cancel_mock,
      runs_get_mock,
      cluster_spec_mock,
      monkeypatch,
  ):
      # pylint: disable=unused-argument
      # Test that MLflow properly handles Databricks run cancellation. We mock the result of
      # the runs-get API to indicate run failure so that cancel() exits instead of blocking while
      # waiting for run status.
      monkeypatch.setenv("DATABRICKS_HOST", "test-host")
      monkeypatch.setenv("DATABRICKS_TOKEN", "foo")
      runs_get_mock.return_value = mock_runs_get_result(succeeded=False)
      submitted_run = run_databricks_project(
          cluster_spec_mock, synchronous=False
      )
      submitted_run.cancel()
      validate_exit_status(submitted_run.get_status(), RunStatus.FAILED)
      assert runs_cancel_mock.call_count == 1
      # Test that we raise an exception when a blocking Databricks run fails
      runs_get_mock.return_value = mock_runs_get_result(succeeded=False)
      with pytest.raises(
          mlflow.projects.ExecutionException,
          match=r"Run \(ID '.+'\) failed",
      ):
          run_databricks_project(cluster_spec_mock, synchronous=True)
  
imports: import filecmp
  import json
  import os
  import shutil
  from unittest import mock
  import databricks_cli
  import pytest
  from databricks_cli.configure.provider import DatabricksConfig
  import mlflow
  from mlflow import MlflowClient, cli
  from mlflow.entities import RunStatus
  from mlflow.environment_variables import MLFLOW_TRACKING_URI
  from mlflow.exceptions import MlflowException
  from mlflow.projects import ExecutionException, databricks
  from mlflow.projects.databricks import DatabricksJobRunner, _get_cluster_mlflow_run_cmd
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE, ErrorCode
  from mlflow.store.tracking.file_store import FileStore
  from mlflow.tracking.request_header.default_request_header_provider import DefaultRequestHeaderProvider
  from mlflow.utils import file_utils
  from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_RUN_URL, MLFLOW_DATABRICKS_SHELL_JOB_RUN_ID, MLFLOW_DATABRICKS_WEBAPP_URL
  from mlflow.utils.uri import construct_db_uri_from_profile
  from tests import helper_functions
  from tests.integration.utils import invoke_cli_runner
  from tests.projects.utils import TEST_PROJECT_DIR, validate_exit_status
label_desc: Use image node_id 24 for calling a global function with example usage: test_run_databricks_cancel(before_run_validations_mock, runs_submit_mock, dbfs_mocks, set_tag_mock, runs_cancel_mock, runs_get_mock, cluster_spec_mock, monkeypatch) without return types