code: def has_resources(self, resources):
          
          if time.time() - self._last_resource_refresh > self._refresh_period:
              self._update_avail_resources()
  
          currently_available = Resources.subtract(self._avail_resources,
                                                   self._committed_resources)
  
          have_space = (
              resources.cpu_total() <= currently_available.cpu
              and resources.gpu_total() <= currently_available.gpu and all(
                  resources.get_res_total(res) <= currently_available.get(res)
                  for res in resources.custom_resources))
  
          if have_space:
              return True
  
          can_overcommit = self._queue_trials
  
          if (resources.cpu_total() > 0 and currently_available.cpu <= 0) or \
             (resources.gpu_total() > 0 and currently_available.gpu <= 0) or \
             any((resources.get_res_total(res_name) > 0
                  and currently_available.get(res_name) <= 0)
                 for res_name in resources.custom_resources):
              can_overcommit = False  # requested resource is already saturated
  
          if can_overcommit:
              logger.warning(
                  "Allowing trial to start even though the "
                  "cluster does not have enough free resources. Trial actors "
                  "may appear to hang until enough resources are added to the "
                  "cluster (e.g., via autoscaling). You can disable this "
                  "behavior by specifying `queue_trials=False` in "
                  "ray.tune.run().")
              return True
  
          return False
docs: Returns whether this runner has at least the specified resources.
  
          This refreshes the Ray cluster resources if the time since last update
          has exceeded self._refresh_period. This also assumes that the
          cluster is not resizing very frequently.