class_docstr: Scheduler extension - server side of MemorySampler
class_docstr_tok: ["Scheduler","extension","-","server","side","of","MemorySampler"]
code: def __init__(self, scheduler: Scheduler):
      self.scheduler = scheduler
      self.scheduler.handlers["memory_sampler_start"] = self.start
      self.scheduler.handlers["memory_sampler_stop"] = self.stop
      self.samples = {}
  
file_path: distributed/distributed/diagnostics/memory_sampler.py
imports: from __future__ import annotations
  import uuid
  from collections.abc import AsyncIterator, Iterator
  from contextlib import asynccontextmanager, contextmanager
  from datetime import datetime
  from typing import TYPE_CHECKING, Any
  from distributed.compatibility import PeriodicCallback
label_desc: Use image node_id 1 to create a new MemorySamplerExtension object  with example: obj = MemorySamplerExtension(scheduler)