code: def test_tpe():
      with ThreadPoolExecutor(2) as e:
          list(e.map(sleep, [0.01] * 4))
  
          threads = e._threads.copy()
          assert len(threads) == 2
  
          def f():
              secede()
              return 1
  
          assert e.submit(f).result() == 1
  
          list(e.map(sleep, [0.01] * 4))
          assert len(threads | e._threads) == 3
  
          start = time()
          while all(t.is_alive() for t in threads):
              sleep(0.01)
              assert time() < start + 1
  
file_path: distributed/distributed/tests/test_threadpoolexecutor.py
imports: from __future__ import annotations
  import threading
  from time import sleep
  from distributed.metrics import time
  from distributed.threadpoolexecutor import ThreadPoolExecutor, rejoin, secede
label_desc: Use image node_id 1 for calling a global function with example usage: test_tpe() and returns: int