code: def test_context(setup_cluster):
      def get_workers():
          ctx = get_context()
          return ctx.get_worker_addresses()
  
      def f1(worker: str):
          ctx = get_context()
          assert worker == ctx.worker_address
          return np.random.rand(3, 3)
  
      def f2(data_key: str, worker: str):
          ctx = get_context()
          assert worker == ctx.worker_address
          meta = ctx.get_chunks_meta([data_key], fields=["bands"])[0]
          assert len(meta) == 1
          ctx.get_chunks_result([data_key], fetch_only=True)
          # fetched, two workers have the data
          meta = ctx.get_chunks_meta([data_key], fields=["bands"])[0]
          assert len(meta["bands"]) == 2
  
      workers = spawn(get_workers).execute().fetch()
      assert len(workers) == len(set(workers)) > 1
  
      r1 = spawn(
          f1, args=(workers[0],), expect_worker=workers[0]
      ).execute()
      data_key = r1._fetch_infos(fields=["data_key"])["data_key"][0]
      r2 = spawn(
          f2, args=(data_key, workers[1]), expect_worker=workers[1]
      )
      r2.execute()
  
      def get_bands():
          ctx = get_context()
          return [
              b
              for b in ctx.get_worker_bands()
              if b[1].startswith("numa-")
          ]
  
      def f3(band: tuple):
          ctx = get_context()
          assert band == ctx.band
          return np.random.rand(3, 3)
  
      def f4(data_key: str, band: tuple):
          ctx = get_context()
          assert band == ctx.band
          meta = ctx.get_chunks_meta([data_key], fields=["bands"])[0]
          assert len(meta) == 1
          ctx.get_chunks_result([data_key], fetch_only=True)
          # fetched, two bands have the data
          meta = ctx.get_chunks_meta([data_key], fields=["bands"])[0]
          assert len(meta["bands"]) == 2
  
      bands = spawn(get_bands).execute().fetch()
      assert len(bands) == len(set(bands)) > 1
  
      r3 = spawn(f3, args=(bands[0],), expect_band=bands[0]).execute()
      data_key = r3._fetch_infos(fields=["data_key"])["data_key"][0]
      r4 = spawn(f4, args=(data_key, bands[1]), expect_band=bands[1])
      r4.execute()
  
imports: from collections import defaultdict
  import numpy
  import pandas
  import pytest
  from ...None import dataframe
  from ...None import get_context
  from ...None import oscar
  from ...None import tensor
  from ...core import tile
  from ...session import get_default_session
  from ...learn.utils import shuffle
  from ...lib.mmh3 import hash
  from ..None import spawn, ExecutableTuple
label_desc: Use image node_id 3 for calling a global function with example usage: test_context(setup_cluster) and returns: ctx, np, unknown, np