Bpstudy20101221

1,817 views
1,759 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,817
On SlideShare
0
From Embeds
0
Number of Embeds
163
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Bpstudy20101221

  1. 1. AppEngine 1.4.0 SDK bpstudy #40 (2010.12.21) @tagomoris
  2. 2. tagomoris TAGOMORI Satoshi / Twitter: @tagomoris E-mail: tagomoris@gmail.com Blog: http://d.hatena.ne.jp/tagomoris/GAETestBase (python), simpleoauth-gae (python),Stratum(ruby), PassengerMonitor(ruby), ... GlassDolphin source code viewer for iPad/iPhone
  3. 3. AppEngine Python SDK AppEngine remote_api
  4. 4. SDK
  5. 5. AppEngine• Python, Java • API • RPC • Service• • MultiQuery batch put
  6. 6. Google Python• •• ••• Google Python Style Guide • http://google-styleguide.googlecode.com/svn/trunk/pyguide.html • http://works.surgo.jp/translation/pyguide.html ( rev 2.15)
  7. 7. Google• import import google.appengine.ext.db.* Model.get(...) from google.appengine.ext import db db.Model.get(...)
  8. 8. Google •# google/appengine/api/datastore.pydef IsInTransaction(): ...._CurrentTransactionKey = IsInTransaction# google/appengine/ext/db/__init__.pyrun_in_transaction = datastore.RunInTransactionRunInTransaction = run_in_transaction
  9. 9. google/appengine/api/appinfo.py (...260, ...636) google/appengine/api/datastore_types.py(1129, ...1584) google/appengine/cron/GrocLexer.py, GrocParser.pygoogle/appengine/datastore/datastore_sqlite_stub.py (...88) google/appengie/ext/db/__init__.py (...1569) google/appengine/runtime/apiproxy.py (...85)
  10. 10. MakeSyncCall
  11. 11. from google.appengine.ext import webappfrom google.appengine.ext.webapp.util import run_wsgi_appfrom google.appengine.ext import dbclass Tekitou(db.Model): passclass MainPage(webapp.RequestHandler): def get(self): Tekitou.get_by_id(100) self.response.out.write("<html><body><p>tagomoris test page...</p></body></html>")application = webapp.WSGIApplication([(/, MainPage), #(/msc_datastore, DatastoreMakeSyncCall), ], debug=True)def main(): run_wsgi_app(application)if __name__ == __main__: main()
  12. 12. RPCTraceback (most recent call last): File ".../google/appengine/ext/webapp/__init__.py", line 515, in __call__ handler.get(*groups) File "/Users/tagomoris/Documents/tagomoris-test/main.py", line 14, in get Tekitou.get_by_id(100) File ".../google/appengine/ext/db/__init__.py", line 1115, in get_by_id return get(keys[0], config=config) File ".../google/appengine/ext/db/__init__.py", line 1320, in get entities = datastore.Get(keys, config=config) File ".../google/appengine/api/datastore.py", line 443, in Get return _GetConnection().async_get(config, keys, extra_hook).get_result() File ".../google/appengine/datastore/datastore_rpc.py", line 548, in get_result self.check_success() File ".../google/appengine/datastore/datastore_rpc.py", line 519, in check_success rpc.check_success() File ".../google/appengine/api/apiproxy_stub_map.py", line 501, in check_success self.__rpc.CheckSuccess() File ".../google/appengine/api/apiproxy_rpc.py", line 149, in _WaitImpl self.request, self.response) File ".../google/appengine/api/datastore_file_stub.py", line 618, in MakeSyncCall response) File ".../google/appengine/api/apiproxy_stub.py", line 80, in MakeSyncCall raise RuntimeError, "just before call method %s" % (_Dynamic_ + call)
  13. 13. ext.db Taskqueue Users Datastore ProtocolBuffer Memcache UrlFetch RPCMakeSyncCall ApiProxyStubMap ApiProxyStubMap ApiProxyStubDatastoreFileStub DatastoreSqliteStub CapabilityStub ServiceStub
  14. 14. ext.db Taskqueue Users Datastore ProtocolBuffer Memcache UrlFetch RPCMakeSyncCall ApiProxyStubMap ApiProxyStubMap ApiProxyStubDatastoreFileStub DatastoreSqliteStub CapabilityStub ServiceStub
  15. 15. ••
  16. 16. 1.google/appengine/ext/db/__init__.py (1115, get_by_id)2.google/appengine/ext/db/__init__.py (1320, get)3.google/appengine/api/datastore.py (443, Get)4.google/appengine/datastore/datastore_rpc.py (548, get_result)5.google/appengine/datastore/datastore_rpc.py (519, check_success)6.google/appengine/api/apiproxy_stub_map.py (501, check_success)7.google/appengine/api/apiproxy_rpc.py (149, _WaitImpl)8.google/appengine/api/datastore_file_stub.py (618, MakeSyncCall)9.google/appengine/api/apiproxy_stub.py (80, MakeSyncCall) google/appengine/runtime/apiproxy.py
  17. 17. remote_api• Stub RemoteStub • Datastore RemoteDatastoreStub• RemoteStub RPC(MakeSyncCall)• appspot HTTP RPC• appspot RemoteApi• ApiProxyStub
  18. 18. remote_api• remote_api_shell.py• GAETestBase• URLFetchService (to Twitter)
  19. 19. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC ServiceApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub
  20. 20. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC Service MakeSyncCall MakeSyncCallApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub
  21. 21. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC Service MakeSyncCall MakeSyncCallApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub
  22. 22. AppEngine SDK AppEngine

×