code: def test_sync(client):
      ms = MemorySampler()
      with ms.sample("foo", measure="managed", interval=0.1):
          f = client.submit(lambda: 1)
          f.result()
          time.sleep(0.5)
  
      assert ms.samples["foo"][0][1] == 0
      assert ms.samples["foo"][-1][1] > 0
  
imports: from __future__ import annotations
  import asyncio
  import time
  import pytest
  from distributed.diagnostics import MemorySampler
  from distributed.utils_test import gen_cluster
label_desc: Use image node_id 1 for calling a global function with example usage: test_sync(client) without return types