code: def swap_buffer(scheduler, es):
      es.buffer, buffer = [], es.buffer
      return buffer
  
file_path: distributed/distributed/diagnostics/eventstream.py
imports: from __future__ import annotations
  import logging
  from distributed.core import coerce_to_address, connect
  from distributed.diagnostics.plugin import SchedulerPlugin
  from distributed.worker import dumps_function
label_desc: Use image node_id 1 for calling a global function with example usage: swap_buffer(scheduler, es) and returns: buffer