code: def _collect_coverage():
      time.sleep(5)
      dist_coverage_path = os.path.join(MARS_ROOT, ".dist-coverage")
      if os.path.exists(dist_coverage_path):
          # change ownership of coverage files
          if find_executable("sudo"):
              proc = subprocess.Popen(
                  [
                      "sudo",
                      "-n",
                      "chown",
                      "-R",
                      f"{os.geteuid()}:{os.getegid()}",
                      dist_coverage_path,
                  ],
                  shell=False,
              )
              proc.wait()
  
          # rewrite paths in coverage result files
          for fn in glob.glob(
              os.path.join(dist_coverage_path, ".coverage.*")
          ):
              cov_db = sqlite3.connect(fn)
              c = cov_db.cursor()
              c.execute(
                  f"UPDATE file SET path=REPLACE(path, '{MARS_ROOT + os.path.sep}', '')"
              )
              cov_db.commit()
              cov_db.close()
  
              if "COVERAGE_FILE" in os.environ:
                  new_cov_file = os.environ[
                      "COVERAGE_FILE"
                  ] + os.path.basename(fn).replace(".coverage", "")
              else:
                  new_cov_file = fn.replace(
                      ".dist-coverage" + os.sep, ""
                  )
              shutil.copyfile(fn, new_cov_file)
          shutil.rmtree(dist_coverage_path)
  
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 1 for calling a global function with example usage: _collect_coverage() without return types