def _handle_script_request(self,
                             environ,
                             start_response,
                             url_map,
                             match,
                             request_id,
                             inst=None,
                             request_type=instance.NORMAL_REQUEST):
    if self._quit_event.is_set():
      return self._error_response(environ, start_response, 404)
    if self._server_configuration.is_backend:
      environ['BACKEND_ID'] = self._server_configuration.server_name
    else:
      environ['BACKEND_ID'] = (
          self._server_configuration.version_id.split('.', 1)[0])
    if inst is not None:
      return self._handle_instance_request(
          environ, start_response, url_map, match, request_id, inst,
          request_type)

    start_time = time.time()
    timeout_time = start_time + self._MAX_REQUEST_WAIT_TIME
    while time.time() < timeout_time:
      if self._quit_event.is_set():
        return self._error_response(environ, start_response, 404)
      inst = self._choose_instance(timeout_time)
      if inst:
        try:
          logging.debug('Dispatching request to %s after %0.4fs pending',
                        inst, time.time() - start_time)
          return inst.handle(environ, start_response, url_map, match,
                             request_id, request_type)
        except instance.CannotAcceptRequests:
          continue
        finally:
          with self._condition:
            self._condition.notify()
    else:
      return self._error_response(environ, start_response, 503)
Return the composite index needed for a query.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/server.py/BasicScalingServer._handle_script_request--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/datastore/datastore_index.py/CompositeIndexForQuery