Reputation: 4719
Is there a way to get the current cpu quota of app engine in python? (The value of CPU Time in the Dashboard Screen of Administrator Console)
Thx in advance
Upvotes: 2
Views: 708
Reputation: 19674
http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/quota.py
If that class is limited, then use trial and error or Jython (slow).
It appears to do what you want, though:
import logging
from google.appengine.api import quota
start = quota.get_request_cpu_usage()
do_something_expensive()
end = quota.get_request_cpu_usage()
logging.info("do_something_expensive() cost %d megacycles." % (end - start))
The new separate Python section for http://code.google.com/appengine/docs/quotas.html appears to be unfinished.
Upvotes: 2