Google Code offered in: English - Español - 日本語 - 한국어 - Português - Pусский - 中文(简体) - 中文(繁體)
The google.appengine.api.runtime
module provides utilities for interacting with the Python runtime. You can use it to gather statistics about instance usage, to determine if an instance is shutting down, and to register a shutdown hook.
This package is implemented in the following methods:
total()
: total Mcycles consumed by this instancerate1m()
: average Mcycles consumed per second over the last minuterate10m()
: average Mcycles consumed per second over the last ten minutesYou can find functions for converting from Mcycles to cpu-seconds in the Quotas API (google.api.quota
).
current()
: amount of memory (MB) currently used by this instanceaverage1m()
: average memory usage (MB) over the last minuteaverage10m()
: average memory usage (MB) over the last ten minutesYou can find functions for converting from Mcycles to cpu-seconds in the Quotas API (google.api.quota
).
Registers a shutdown hook to call when the backend is shutting down. Upon notification of shutdown, your application has a short amount of time to save state and exit. The shutdown hook should interrupt any long-running code you have, for example by calling apiproxy_stub_map.apiproxy.CancelApiCalls()
and/or raising an exception.
Arguments:
Returns the previously registered shutdown hook, or None if no hook was registered.
Warning! In some cases, it may not be possible to run the shutdown hook before the server exits. See Stopping Backends for more information.