code: def test_worker_preload_file(loop):
      def check_worker():
          import worker_info
  
          return worker_info.get_worker_address()
  
      tmpdir = tempfile.mkdtemp()
      try:
          path = os.path.join(tmpdir, "worker_info.py")
          with open(path, "w") as f:
              f.write(PRELOAD_TEXT)
  
          with cluster(worker_kwargs={"preload": [path]}) as (
              s,
              workers,
          ), Client(s["address"], loop=loop) as c:
              assert c.run(check_worker) == {
                  worker["address"]: worker["address"]
                  for worker in workers
              }
      finally:
          shutil.rmtree(tmpdir)
  
file_path: distributed/distributed/tests/test_preload.py
imports: from __future__ import annotations
  import os
  import re
  import shutil
  import sys
  import tempfile
  from textwrap import dedent
  from unittest import mock
  import pytest
  import dask
  from distributed import Client, Nanny, Scheduler, Worker
  from distributed.preloading import Preload
  from distributed.utils import open_port
  from distributed.utils_test import captured_logger, cluster, gen_cluster, gen_test
label_desc: Use image node_id 1 for calling a global function with example usage: test_worker_preload_file(loop) and returns: worker_info