code: def test_run_with_packed_env():
      import conda_pack
  
      temp_dir = os.environ.get("MARS_YARN_TEST_DIR")
      clean_after_test = False
      if temp_dir is None:
          clean_after_test = True
          temp_dir = tempfile.mkdtemp(prefix="test-mars-yarn-")
      else:
          os.makedirs(temp_dir, exist_ok=True)
  
      packed_env_file = os.path.join(temp_dir, "mars-test-env.tar.gz")
      if not os.path.exists(packed_env_file):
          try:
              conda_pack.pack(
                  output=packed_env_file, ignore_editable_packages=True
              )
          except conda_pack.CondaPackException:
              logger.exception(
                  "Failed to pack environment, this test will be skipped"
              )
              return
  
      try:
          _run_yarn_test_with_env(packed_env_file, 1200)
      finally:
          if clean_after_test:
              shutil.rmtree(temp_dir)
  
file_path: mars/mars/deploy/yarn/tests/test_yarn.py
imports: import glob
  import logging
  import os
  import shutil
  import sqlite3
  import subprocess
  import tempfile
  import time
  from distutils.spawn import find_executable
  import numpy
  import pytest
  from ....None import tensor
  from ....tests.core import flaky, require_hadoop
  from ...yarn import new_cluster
label_desc: Use image node_id 4 for calling a global function with example usage: test_run_with_packed_env() without return types