App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | List of all members
google.appengine.tools.devappserver2.instance.Instance Class Reference
Inheritance diagram for google.appengine.tools.devappserver2.instance.Instance:

Public Member Functions

def __init__
 
def __repr__
 
def instance_id
 
def total_requests
 
def remaining_request_capacity
 
def remaining_background_thread_capacity
 
def num_outstanding_requests
 
def idle_seconds
 
def handling_ready_request
 
def get_latency_60s
 
def get_qps_60s
 
def has_quit
 
def can_accept_requests
 
def start
 
def quit
 
def reserve_background_thread
 
def handle
 
def wait
 

Detailed Description

Handle requests through a RuntimeProxy.

Constructor & Destructor Documentation

def google.appengine.tools.devappserver2.instance.Instance.__init__ (   self,
  request_data,
  instance_id,
  runtime_proxy,
  max_concurrent_requests,
  max_background_threads = 0,
  expect_ready_request = False 
)
Initializer for Instance.

Args:
  request_data: A wsgi_request_info.WSGIRequestInfo that will be provided
  with request information for use by API stubs.
  instance_id: A string or integer representing the unique (per module) id
  of the instance.
  runtime_proxy: A RuntimeProxy instance that will be used to handle
  requests.
  max_concurrent_requests: The maximum number of concurrent requests that
  the instance can handle. If the instance does not support concurrent
  requests then the value should be 1.
  max_background_threads: The maximum number of background threads that
  the instance can handle. If the instance does not support background
  threads then the value should be 0.
  expect_ready_request: If True then the instance will be sent a special
  request (i.e. /_ah/warmup or /_ah/start) before it can handle external
  requests.

Member Function Documentation

def google.appengine.tools.devappserver2.instance.Instance.can_accept_requests (   self)
True if .handle() will accept requests.

Does not consider outstanding request volume.
def google.appengine.tools.devappserver2.instance.Instance.get_latency_60s (   self)
Returns the average request latency over the last 60s in seconds.
def google.appengine.tools.devappserver2.instance.Instance.get_qps_60s (   self)
Returns the average queries-per-second over the last 60 seconds.
def google.appengine.tools.devappserver2.instance.Instance.handle (   self,
  environ,
  start_response,
  url_map,
  match,
  request_id,
  request_type 
)
Handles an HTTP request by forwarding it to the RuntimeProxy.

Args:
  environ: An environ dict for the request as defined in PEP-333.
  start_response: A function with semantics defined in PEP-333.
  url_map: An appinfo.URLMap instance containing the configuration for the
  handler matching this request.
  match: A re.MatchObject containing the result of the matched URL pattern.
  request_id: A unique string id associated with the request.
  request_type: The type of the request. See *_REQUEST module constants.

Returns:
  An iterable over strings containing the body of the HTTP response.

Raises:
  CannotAcceptRequests: if the Instance has quit or is already handling the
  maximum permissible number of concurrent requests.
def google.appengine.tools.devappserver2.instance.Instance.handling_ready_request (   self)
True if the Instance is handling or will be sent a ready request.
def google.appengine.tools.devappserver2.instance.Instance.idle_seconds (   self)
The number of seconds that the Instance has been idle.

Will be 0.0 if the Instance has not started.
def google.appengine.tools.devappserver2.instance.Instance.instance_id (   self)
The unique string or integer id for the Instance.
def google.appengine.tools.devappserver2.instance.Instance.num_outstanding_requests (   self)
The number of requests that the Instance is currently handling.
def google.appengine.tools.devappserver2.instance.Instance.quit (   self,
  allow_async = False,
  force = False,
  expect_shutdown = False 
)
Quits the instance and the RuntimeProxy.

Args:
  allow_async: Whether to enqueue the quit after all requests have completed
  if the instance cannot be quit immediately.
  force: Whether to force the instance to quit even if the instance is
  currently handling a request. This overrides allow_async if True.
  expect_shutdown: Whether the instance will be sent a shutdown request.

Raises:
  CannotQuitServingInstance: if the Instance is currently handling a
  request and allow_async is False.
def google.appengine.tools.devappserver2.instance.Instance.remaining_background_thread_capacity (   self)
The number of extra background threads the Instance can handle.
def google.appengine.tools.devappserver2.instance.Instance.remaining_request_capacity (   self)
The number of extra requests that the Instance can currently handle.
def google.appengine.tools.devappserver2.instance.Instance.reserve_background_thread (   self)
Reserves a background thread slot.

Raises:
  CannotAcceptRequests: if the Instance is already handling the maximum
  permissible number of background threads or is not in a state where it
  can handle background threads.
def google.appengine.tools.devappserver2.instance.Instance.start (   self)
Start the instance and the RuntimeProxy.

Returns:
  True if the Instance was started or False, if the Instance has already
  been quit.
def google.appengine.tools.devappserver2.instance.Instance.total_requests (   self)
The total number requests that the Instance has handled.
def google.appengine.tools.devappserver2.instance.Instance.wait (   self,
  timeout_time 
)
Wait for this instance to have capacity to serve a request.

Args:
  timeout_time: A float containing a time in seconds since the epoch to wait
  until before timing out.

Returns:
  True if the instance has request capacity or False if the timeout time was
  reached or the instance has been quit.

The documentation for this class was generated from the following file: