SlideShare a Scribd company logo
1 of 26
Download to read offline
AppEngine 1.4.0 SDK


   bpstudy #40 (2010.12.21)
         @tagomoris
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
AppEngine Python SDK




    AppEngine

        remote_api
SDK
AppEngine
• Python, Java

    •       API

        •                  RPC

    • Service

•

    • MultiQuery   batch put
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)
Google
• import

  import google.appengine.ext.db.*
  Model.get(...)



  from google.appengine.ext import db
  db.Model.get(...)
Google
  •

# google/appengine/api/datastore.py
def IsInTransaction():
      ....
_CurrentTransactionKey = IsInTransaction


# google/appengine/ext/db/__init__.py
run_in_transaction = datastore.RunInTransaction
RunInTransaction = run_in_transaction
google/appengine/api/appinfo.py (...260, ...636)
 google/appengine/api/datastore_types.py(1129, ...1584)
   google/appengine/cron/GrocLexer.py, GrocParser.py
google/appengine/datastore/datastore_sqlite_stub.py (...88)
       google/appengie/ext/db/__init__.py (...1569)
       google/appengine/runtime/apiproxy.py (...85)
MakeSyncCall
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db

class Tekitou(db.Model):
  pass

class 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()
RPC

Traceback (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)
ext.db



                              Taskqueue              Users                   Datastore

     ProtocolBuffer                    Memcache                 UrlFetch


                            RPC
MakeSyncCall                                ApiProxyStubMap                ApiProxyStubMap
                        ApiProxyStub



DatastoreFileStub     DatastoreSqliteStub      CapabilityStub                   ServiceStub
ext.db



                              Taskqueue              Users                   Datastore

     ProtocolBuffer                    Memcache                 UrlFetch


                            RPC
MakeSyncCall                                ApiProxyStubMap                ApiProxyStubMap
                        ApiProxyStub



DatastoreFileStub     DatastoreSqliteStub      CapabilityStub                   ServiceStub
•

•
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
remote_api
•             Stub        RemoteStub

    • Datastore      RemoteDatastoreStub

• RemoteStub             RPC(MakeSyncCall)

•                      appspot             HTTP RPC

• appspot RemoteApi

•                 ApiProxyStub
remote_api

• remote_api_shell.py

• GAETestBase

• URLFetchService       (to Twitter)
remote_api RPC
      remote_api_shell



       user application              remote_api handler


                          HTTP RPC
           Service




ApiProxyStubMap                           ApiProxyStubMap




        RemoteStub                       ServiceStub
remote_api RPC
      remote_api_shell



       user application                        remote_api handler


                                    HTTP RPC
           Service
                                                  MakeSyncCall


                     MakeSyncCall

ApiProxyStubMap                                     ApiProxyStubMap




        RemoteStub                                 ServiceStub
remote_api RPC
      remote_api_shell



       user application                        remote_api handler


                                    HTTP RPC
           Service
                                                  MakeSyncCall


                     MakeSyncCall

ApiProxyStubMap                                     ApiProxyStubMap




        RemoteStub                                 ServiceStub
AppEngine SDK




 AppEngine
Bpstudy20101221
Bpstudy20101221

More Related Content

What's hot

HBase + Hue - LA HBase User Group
HBase + Hue - LA HBase User GroupHBase + Hue - LA HBase User Group
HBase + Hue - LA HBase User Groupgethue
 
RESTful in Drupal 8 and Services module - New`n`Tasty!
RESTful in Drupal 8 and Services module - New`n`Tasty!RESTful in Drupal 8 and Services module - New`n`Tasty!
RESTful in Drupal 8 and Services module - New`n`Tasty!Dmytro Olaresko
 
Hadoop Israel - HBase Browser in Hue
Hadoop Israel - HBase Browser in HueHadoop Israel - HBase Browser in Hue
Hadoop Israel - HBase Browser in Huegethue
 
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core Acquia
 
Puppet at janrain
Puppet at janrainPuppet at janrain
Puppet at janrainPuppet
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineAndy McKay
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkRed Hat Developers
 
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech TalkHacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech TalkRed Hat Developers
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at BazaarvoicePuppet
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gearsdion
 
Server Side Swift with Swag
Server Side Swift with SwagServer Side Swift with Swag
Server Side Swift with SwagJens Ravens
 

What's hot (12)

HBase + Hue - LA HBase User Group
HBase + Hue - LA HBase User GroupHBase + Hue - LA HBase User Group
HBase + Hue - LA HBase User Group
 
RESTful in Drupal 8 and Services module - New`n`Tasty!
RESTful in Drupal 8 and Services module - New`n`Tasty!RESTful in Drupal 8 and Services module - New`n`Tasty!
RESTful in Drupal 8 and Services module - New`n`Tasty!
 
Hadoop Israel - HBase Browser in Hue
Hadoop Israel - HBase Browser in HueHadoop Israel - HBase Browser in Hue
Hadoop Israel - HBase Browser in Hue
 
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core
 
Puppet at janrain
Puppet at janrainPuppet at janrain
Puppet at janrain
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
 
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech TalkHacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
 
REST in Peace
REST in PeaceREST in Peace
REST in Peace
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at Bazaarvoice
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
 
Server Side Swift with Swag
Server Side Swift with SwagServer Side Swift with Swag
Server Side Swift with Swag
 

Similar to Bpstudy20101221

App engine ja night 9 beertalk2
App engine ja night 9 beertalk2App engine ja night 9 beertalk2
App engine ja night 9 beertalk2SATOSHI TAGOMORI
 
Motion Django Meetup
Motion Django MeetupMotion Django Meetup
Motion Django MeetupMike Malone
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesciklum_ods
 
Deep Dive into SpaceONE
Deep Dive into SpaceONEDeep Dive into SpaceONE
Deep Dive into SpaceONEChoonho Son
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Tim Burks
 
ajn13 BeerTalk FlexRemoteApi
ajn13 BeerTalk FlexRemoteApiajn13 BeerTalk FlexRemoteApi
ajn13 BeerTalk FlexRemoteApiSATOSHI TAGOMORI
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 
Creating a modern web application using Symfony API Platform, ReactJS and Red...
Creating a modern web application using Symfony API Platform, ReactJS and Red...Creating a modern web application using Symfony API Platform, ReactJS and Red...
Creating a modern web application using Symfony API Platform, ReactJS and Red...Jesus Manuel Olivas
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswanivvaswani
 
Cloud native programming model comparison
Cloud native programming model comparisonCloud native programming model comparison
Cloud native programming model comparisonEmily Jiang
 
Java-Jersey 到 Python-Flask 服務不中斷重構之旅
Java-Jersey 到 Python-Flask 服務不中斷重構之旅Java-Jersey 到 Python-Flask 服務不中斷重構之旅
Java-Jersey 到 Python-Flask 服務不中斷重構之旅Max Lai
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Webnickmbailey
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverFastly
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScriptQiangning Hong
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversTatsuhiko Miyagawa
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsGraham Dumpleton
 

Similar to Bpstudy20101221 (20)

App engine ja night 9 beertalk2
App engine ja night 9 beertalk2App engine ja night 9 beertalk2
App engine ja night 9 beertalk2
 
Motion Django Meetup
Motion Django MeetupMotion Django Meetup
Motion Django Meetup
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Deep Dive into SpaceONE
Deep Dive into SpaceONEDeep Dive into SpaceONE
Deep Dive into SpaceONE
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)
 
Gohan
GohanGohan
Gohan
 
ajn13 BeerTalk FlexRemoteApi
ajn13 BeerTalk FlexRemoteApiajn13 BeerTalk FlexRemoteApi
ajn13 BeerTalk FlexRemoteApi
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Creating a modern web application using Symfony API Platform, ReactJS and Red...
Creating a modern web application using Symfony API Platform, ReactJS and Red...Creating a modern web application using Symfony API Platform, ReactJS and Red...
Creating a modern web application using Symfony API Platform, ReactJS and Red...
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
 
Cloud native programming model comparison
Cloud native programming model comparisonCloud native programming model comparison
Cloud native programming model comparison
 
Java-Jersey 到 Python-Flask 服務不中斷重構之旅
Java-Jersey 到 Python-Flask 服務不中斷重構之旅Java-Jersey 到 Python-Flask 服務不中斷重構之旅
Java-Jersey 到 Python-Flask 服務不中斷重構之旅
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Web
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript
 
API gateway setup
API gateway setupAPI gateway setup
API gateway setup
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web Applications
 

More from SATOSHI TAGOMORI

Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speedSATOSHI TAGOMORI
 
Good Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsGood Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsSATOSHI TAGOMORI
 
Invitation to the dark side of Ruby
Invitation to the dark side of RubyInvitation to the dark side of Ruby
Invitation to the dark side of RubySATOSHI TAGOMORI
 
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)SATOSHI TAGOMORI
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script ConfusingSATOSHI TAGOMORI
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubySATOSHI TAGOMORI
 
Lock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsLock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsSATOSHI TAGOMORI
 
Data Processing and Ruby in the World
Data Processing and Ruby in the WorldData Processing and Ruby in the World
Data Processing and Ruby in the WorldSATOSHI TAGOMORI
 
Planet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamPlanet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamSATOSHI TAGOMORI
 
Technologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessTechnologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessSATOSHI TAGOMORI
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage SystemsSATOSHI TAGOMORI
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd SeasonSATOSHI TAGOMORI
 
To Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToTo Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToSATOSHI TAGOMORI
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersSATOSHI TAGOMORI
 
How To Write Middleware In Ruby
How To Write Middleware In RubyHow To Write Middleware In Ruby
How To Write Middleware In RubySATOSHI TAGOMORI
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldSATOSHI TAGOMORI
 
Open Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceOpen Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceSATOSHI TAGOMORI
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and ThenSATOSHI TAGOMORI
 

More from SATOSHI TAGOMORI (20)

Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speed
 
Good Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsGood Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/Operations
 
Maccro Strikes Back
Maccro Strikes BackMaccro Strikes Back
Maccro Strikes Back
 
Invitation to the dark side of Ruby
Invitation to the dark side of RubyInvitation to the dark side of Ruby
Invitation to the dark side of Ruby
 
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script Confusing
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in Ruby
 
Lock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsLock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive Operations
 
Data Processing and Ruby in the World
Data Processing and Ruby in the WorldData Processing and Ruby in the World
Data Processing and Ruby in the World
 
Planet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamPlanet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: Bigdam
 
Technologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessTechnologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise Business
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd Season
 
Fluentd 101
Fluentd 101Fluentd 101
Fluentd 101
 
To Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToTo Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT To
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
How To Write Middleware In Ruby
How To Write Middleware In RubyHow To Write Middleware In Ruby
How To Write Middleware In Ruby
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 
Open Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceOpen Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud Service
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and Then
 

Bpstudy20101221

  • 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.
  • 4. AppEngine Python SDK AppEngine remote_api
  • 5. SDK
  • 6. AppEngine • Python, Java • API • RPC • Service • • MultiQuery batch put
  • 7. 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)
  • 8. Google • import import google.appengine.ext.db.* Model.get(...) from google.appengine.ext import db db.Model.get(...)
  • 9. Google • # google/appengine/api/datastore.py def IsInTransaction(): .... _CurrentTransactionKey = IsInTransaction # google/appengine/ext/db/__init__.py run_in_transaction = datastore.RunInTransaction RunInTransaction = run_in_transaction
  • 10.
  • 11. google/appengine/api/appinfo.py (...260, ...636) google/appengine/api/datastore_types.py(1129, ...1584) google/appengine/cron/GrocLexer.py, GrocParser.py google/appengine/datastore/datastore_sqlite_stub.py (...88) google/appengie/ext/db/__init__.py (...1569) google/appengine/runtime/apiproxy.py (...85)
  • 13. from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext import db class Tekitou(db.Model): pass class 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()
  • 14. RPC Traceback (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)
  • 15. ext.db Taskqueue Users Datastore ProtocolBuffer Memcache UrlFetch RPC MakeSyncCall ApiProxyStubMap ApiProxyStubMap ApiProxyStub DatastoreFileStub DatastoreSqliteStub CapabilityStub ServiceStub
  • 16. ext.db Taskqueue Users Datastore ProtocolBuffer Memcache UrlFetch RPC MakeSyncCall ApiProxyStubMap ApiProxyStubMap ApiProxyStub DatastoreFileStub DatastoreSqliteStub CapabilityStub ServiceStub
  • 18. 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
  • 19. remote_api • Stub RemoteStub • Datastore RemoteDatastoreStub • RemoteStub RPC(MakeSyncCall) • appspot HTTP RPC • appspot RemoteApi • ApiProxyStub
  • 21. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC Service ApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub
  • 22. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC Service MakeSyncCall MakeSyncCall ApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub
  • 23. remote_api RPC remote_api_shell user application remote_api handler HTTP RPC Service MakeSyncCall MakeSyncCall ApiProxyStubMap ApiProxyStubMap RemoteStub ServiceStub