code: def _populate_run_dir(
      submit_config: SubmitConfig, run_dir: str
  ) -> None:
      """Copy all necessary files into the run dir. Assumes that the dir exists, is local, and is writable."""
      pickle.dump(
          submit_config,
          open(os.path.join(run_dir, "submit_config.pkl"), "wb"),
      )
      with open(os.path.join(run_dir, "submit_config.txt"), "w") as f:
          pprint.pprint(
              submit_config,
              stream=f,
              indent=4,
              width=200,
              compact=False,
          )
  
      if (
          submit_config.submit_target == SubmitTarget.LOCAL
      ) and submit_config.local.do_not_copy_source_files:
          return
  
      files = []
  
      run_func_module_dir_path = util.get_module_dir_by_obj_name(
          submit_config.run_func_name
      )
      assert "." in submit_config.run_func_name
      for _idx in range(submit_config.run_func_name.count(".") - 1):
          run_func_module_dir_path = os.path.dirname(
              run_func_module_dir_path
          )
      files += util.list_dir_recursively_with_ignore(
          run_func_module_dir_path,
          ignores=submit_config.run_dir_ignore,
          add_base_to_relative=False,
      )
  
      dnnlib_module_dir_path = util.get_module_dir_by_obj_name("dnnlib")
      files += util.list_dir_recursively_with_ignore(
          dnnlib_module_dir_path,
          ignores=submit_config.run_dir_ignore,
          add_base_to_relative=True,
      )
  
      files += submit_config.run_dir_extra_files
  
      files = [
          (f[0], os.path.join(run_dir, "src", f[1])) for f in files
      ]
      files += [
          (
              os.path.join(
                  dnnlib_module_dir_path,
                  "submission",
                  "internal",
                  "run.py",
              ),
              os.path.join(run_dir, "run.py"),
          )
      ]
  
      util.copy_files_and_create_dirs(files)
  
imports: import copy
  import inspect
  import os
  import pathlib
  import pickle
  import platform
  import pprint
  import re
  import shutil
  import sys
  import time
  import traceback
  from enum import Enum
  from ..None import util
label_desc: Use image node_id 9 for calling a global function with example usage: _populate_run_dir(submit_config, run_dir) without return types