code: def test_context_meter_clear_callbacks():
      def raises(*args):
          raise RuntimeError("hello")
  
      m = []
  
      with metrics.context_meter.add_callback(raises):
          with pytest.raises(RuntimeError, match="hello"):
              metrics.context_meter.digest_metric("foo", 1, "s")
          with metrics.context_meter.clear_callbacks():
              metrics.context_meter.digest_metric(
                  "foo", 1, "s"
              )  # No callbacks
              with metrics.context_meter.add_callback(
                  lambda l, v, u: m.append((l, v, u))
              ):
                  metrics.context_meter.digest_metric("foo", 1, "s")
          with pytest.raises(RuntimeError, match="hello"):
              metrics.context_meter.digest_metric("foo", 1, "s")
  
      assert m == [("foo", 1, "s")]
  
imports: from __future__ import annotations
  import math
  import pickle
  import threading
  import time
  import pytest
  from distributed import metrics
  from distributed.compatibility import WINDOWS
  from distributed.utils import offload
  from distributed.utils_test import gen_test
label_desc: Use image node_id 12 for calling a global function with example usage: test_context_meter_clear_callbacks() without return types