class_docstr: Represent a Volume that will be mapped to a container.
class_docstr_tok: ["Represent","a","Volume","that","will","be","mapped","to","a","container","."]
docstr: Create a Volume instance.
  
  The container path can be provided as a container_dir or as a channel name but not both.
  
  Args:
      host_dir (str): path to the volume data in the host
      container_dir (str): path inside the container that host_dir will be mapped to
      channel (str): channel name that the host_dir represents. It will be mapped as
          /opt/ml/input/data/<channel> in the container.
docstr_tok: ["Create","a","Volume","instance",".","The","container","path","can","be","provided","as","a","container_dir","or","as","a","channel","name","but","not","both",".","Args",":","host_dir","(","str",")",":","path","to","the","volume","data","in","the","host","container_dir","(","str",")",":","path","inside","the","container","that","host_dir","will","be","mapped","to","channel","(","str",")",":","channel","name","that","the","host_dir","represents",".","It","will","be","mapped","as","\/opt\/ml\/input\/data\/","<","channel",">","in","the","container","."]
code: def __init__(self, host_dir, container_dir=None, channel=None):
      """Create a Volume instance.
  
      The container path can be provided as a container_dir or as a channel name but not both.
  
      Args:
          host_dir (str): path to the volume data in the host
          container_dir (str): path inside the container that host_dir will be mapped to
          channel (str): channel name that the host_dir represents. It will be mapped as
              /opt/ml/input/data/<channel> in the container.
      """
      if not container_dir and not channel:
          raise ValueError(
              "Either container_dir or channel must be declared."
          )
  
      if container_dir and channel:
          raise ValueError(
              "container_dir and channel cannot be declared together."
          )
  
      self.container_dir = (
          container_dir
          if container_dir
          else "/opt/ml/input/data/" + channel
      )
      self.host_dir = host_dir
      map_format = "{}:{}"
      if platform.system() == "Linux" and SELINUX_ENABLED:
          # Support mounting shared volumes in SELinux enabled hosts
          map_format += ":z"
      if platform.system() == "Darwin" and host_dir.startswith("/var"):
          self.host_dir = os.path.join("/private", host_dir)
  
      self.map = map_format.format(self.host_dir, self.container_dir)
  
imports: from __future__ import absolute_import, annotations
  import base64
  import copy
  import errno
  import json
  import logging
  import os
  import platform
  import random
  import re
  import shlex
  import shutil
  import string
  import subprocess
  import sys
  import tarfile
  import tempfile
  from distutils.spawn import find_executable
  from threading import Thread
  from typing import Dict, List
  from six.moves.urllib.parse import urlparse
  import sagemaker
  from sagemaker.config.config_schema import CONTAINER_CONFIG, LOCAL
  import sagemaker.local.data
  import sagemaker.local.utils
  import sagemaker.utils
label_desc: Use image node_id 1 to create a new _Volume object from inherited base classes: object with example: obj = _Volume(host_dir, container_dir, channel)