docs: def gpu_queue(options):
      """
      Queued up containers waiting for GPU resources
      """
      import docker
      import json
      import os
      import time
  
      from vent.helpers.meta import GpuUsage
  
      status = (False, None)
      if (os.path.isfile('/root/.vent/vent.cfg') and os.path.isfile('/root/.vent/plugin_manifest.cfg')):
          path_dir = '/root/.vent'
      else:
          path_dir = '/vent'
  
      print('gpu queue', str(options))
      print('gpu queue', str(GpuUsage(base_dir=path_dir+'/',
                                      meta_dir=path_dir)))
  
      options = json.loads(options)
      configs = options['configs']
      gpu_options = configs['gpu_options']
      devices = []
      options['remove'] = True
  
      # device specified, remove all other devices
      if 'device' in gpu_options:
          dev = '/dev/nvidia' + gpu_options['device'] + ':/dev/nvidia'
          dev += gpu_options['device'] + ':rwm'
          if 'devices' in configs:
              d = list(configs['devices'])
              for device in d:
                  if any(str.isdigit(str(char)) for char in device):
                      if dev == device:
                          devices.append(device)
                      else:
                          configs['devices'].remove(device)
      else:
          d = configs['devices']
          for device in d:
              if any(str.isdigit(str(char)) for char in device):
                  devices.append(device)
  
      # check if devices is still an empty list
      if not devices:
          status = (False, 'no valid devices match the requested device')
          print(str(status))
          return status
  
      mem_needed = 0
      dedicated = False
      # need a gpu to itself
      if ('dedicated' in configs['gpu_options'] and
              configs['gpu_options']['dedicated'] == 'yes'):
          dedicated = True
      if 'mem_mb' in configs['gpu_options']:
          # TODO input error checking
          mem_needed = int(configs['gpu_options']['mem_mb'])
  
      print('mem_needed: ', mem_needed)
      print('dedicated: ', dedicated)
      device = None
      while not device:
          usage = GpuUsage(base_dir=path_dir+'/', meta_dir=path_dir)
  
          if usage[0]:
              usage = usage[1]
          else:
              return usage
          print(usage)
          # {"device": "0",
          #  "mem_mb": "1024",
          #  "dedicated": "yes",
          #  "enabled": "yes"}
          for d in devices:
              dev = str(d.split(':')[0].split('nvidia')[1])
              print(dev)
              # if the device is already dedicated, can't be used
              dedicated_gpus = usage['vent_usage']['dedicated']
              is_dedicated = False
              for gpu in dedicated_gpus:
                  if dev in gpu:
                      is_dedicated = True
              print('is_dedicated: ', is_dedicated)
              if not is_dedicated:
                  ram_used = 0
                  if dev in usage['vent_usage']['mem_mb']:
                      ram_used = usage['vent_usage']['mem_mb'][dev]
                  # check for vent usage/processes running
                  if (dedicated and
                      dev not in usage['vent_usage']['mem_mb'] and
                      mem_needed <= usage[int(dev)]['global_memory'] and
                          not usage[int(dev)]['processes']):
                      device = dev
                  # check for ram constraints
                  elif mem_needed <= (usage[int(dev)]['global_memory'] - ram_used):
                      device = dev
  
          # TODO make this sleep incremental up to a point, potentially kill
          #      after a set time configured from vent.cfg, outputting as it goes
          time.sleep(1)
  
      # lock jobs to a specific gpu (no shared GPUs for a single process) this is
      # needed to calculate if memory requested (but not necessarily in use)
      # would become oversubscribed
  
      # store which device was mapped
      options['labels']['vent.gpu.device'] = device
      gpu_device = '/dev/nvidia' + device + ':/dev/nvidia' + device + ':rwm'
      if 'devices' in configs:
          d = configs['devices']
          for dev in d:
              if any(str.isdigit(str(char)) for char in dev):
                  if gpu_device != dev:
                      configs['devices'].remove(dev)
  
      try:
          d_client = docker.from_env()
          del options['configs']
          del configs['gpu_options']
          params = options.copy()
          params.update(configs)
          d_client.containers.run(**params)
          status = (True, None)
      except Exception as e:  # pragma: no cover
          status = (False, str(e))
  
      print(str(status))
      return status