code: def test_sync(client):
      def mysum():
          result = 0
          sub_tasks = [delayed(double)(i) for i in range(100)]
  
          with worker_client() as lc:
              futures = lc.compute(sub_tasks)
              for f in as_completed(futures):
                  result += f.result()
          return result
  
      assert delayed(mysum)().compute() == 9900
  
file_path: distributed/distributed/tests/test_worker_client.py
imports: from __future__ import annotations
  import asyncio
  import random
  import threading
  from collections import defaultdict
  from time import sleep
  import pytest
  import dask
  from dask import delayed
  from distributed import Client, as_completed, get_client, get_worker, wait, worker_client
  from distributed.metrics import time
  from distributed.utils_test import double, gen_cluster, inc, slowinc
label_desc: Use image node_id 1 for calling a global function with example usage: test_sync(client) and returns: result