Bpstudy20101221
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Bpstudy20101221

on

  • 2,121 views

 

Statistics

Views

Total Views
2,121
Views on SlideShare
1,969
Embed Views
152

Actions

Likes
1
Downloads
3
Comments
0

2 Embeds 152

http://d.hatena.ne.jp 151
http://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Bpstudy20101221 Presentation Transcript

  • 1. AppEngine 1.4.0 SDK bpstudy #40 (2010.12.21) @tagomoris
  • 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. AppEngine Python SDK AppEngine remote_api
  • 4. SDK
  • 5. AppEngine• Python, Java • API • RPC • Service• • MultiQuery batch put
  • 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. Google• import import google.appengine.ext.db.* Model.get(...) from google.appengine.ext import db db.Model.get(...)
  • 8. Google •# google/appengine/api/datastore.pydef IsInTransaction(): ...._CurrentTransactionKey = IsInTransaction# google/appengine/ext/db/__init__.pyrun_in_transaction = datastore.RunInTransactionRunInTransaction = run_in_transaction
  • 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. MakeSyncCall
  • 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. 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. ext.db Taskqueue Users Datastore ProtocolBuffer Memcache UrlFetch RPCMakeSyncCall ApiProxyStubMap ApiProxyStubMap ApiProxyStubDatastoreFileStub DatastoreSqliteStub CapabilityStub ServiceStub
  • 14. ext.db Taskqueue Users Datastore ProtocolBuffer Memcache UrlFetch RPCMakeSyncCall ApiProxyStubMap ApiProxyStubMap ApiProxyStubDatastoreFileStub DatastoreSqliteStub CapabilityStub ServiceStub
  • 15. ••
  • 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. remote_api• Stub RemoteStub • Datastore RemoteDatastoreStub• RemoteStub RPC(MakeSyncCall)• appspot HTTP RPC• appspot RemoteApi• ApiProxyStub
  • 18. remote_api• remote_api_shell.py• GAETestBase• URLFetchService (to Twitter)
  • 19. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC ServiceApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub
  • 20. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC Service MakeSyncCall MakeSyncCallApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub
  • 21. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC Service MakeSyncCall MakeSyncCallApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub
  • 22. AppEngine SDK AppEngine