code: def _tar_path_subprocess(
      source_path: str, target_file: str, compression: bool = False
  ) -> None:
      """Create tar from directory using `tar`
  
      Parameters
      ----------
      source_path: str
          Source directory or file
      target_file
          Target tar file
      compression: bool, default False
          Enable compression, which is disabled by default.
  
      """
      # Only add compression when users explicitly request it.
      # We do this because it takes too long to compress
      # large datastores.
      tar_flags = "-cvf"
      if compression:
          tar_flags = "-zcvf"
      if os.path.isdir(source_path):
          command = f"tar -C {source_path} {tar_flags} {target_file} ./"
      else:
          abs_path = os.path.abspath(source_path)
          parent_dir = os.path.dirname(abs_path)
          base_name = os.path.basename(abs_path)
          command = f"tar -C {parent_dir} {tar_flags} {target_file} {base_name}"
  
      subprocess.check_call(
          command,
          stdout=subprocess.DEVNULL,
          stderr=subprocess.DEVNULL,
          shell=True,
          env={"GZIP": "-9", "COPYFILE_DISABLE": "1"},
      )
  
file_path: pytorch-lightning/src/lightning/app/source_code/tar.py
imports: import math
  import os
  import subprocess
  import tarfile
  from dataclasses import dataclass
  from typing import Optional, Tuple
  import click
label_desc: Use image node_id 5 for calling a global function with example usage: _tar_path_subprocess(source_path, target_file, compression) without return types