简体   繁体   English

Google App Engine后端启动

[英]Google App Engine backend starts

I am writing a GAE application that when it starts needs to initialise a connection to a third party service, and then run a continuous check in the background (essentially pulling data from third party and pushing it to a GAE task queue) 我正在编写一个GAE应用程序,该应用程序启动时需要初始化与第三方服务的连接,然后在后台运行连续检查(基本上是从第三方提取数据并将其推送到GAE任务队列)

I know that backends get a call to /_ah/start which initialises them and lets GAE know the backend has started. 我知道后端会调用/ _ah / start来对其进行初始化,并让GAE知道后端已经启动。 Is it safe to start the pull process from StartHandler, ie 从StartHandler开始拉动过程是否安全,即

f = urllib2.urlop
for l in f:
     deferred.defer(doMyStuff,l)

I think the answer is to have a StartHandler along the lines of: 我认为答案是按照以下方式使用StartHandler:

class StartHandler(webapp2.RequestHandler):
    def get(self):
        logging.info("Handler started")
        key = self.request.get('key')
        taskqueue.add('/backend/startdata', params={'key':key}, target='1.backend0')

and then have the handler for /backend/startdata run the loop. 然后让/backend/startdata的处理程序运行循环。

Advice and comments welcome. 咨询和评论欢迎。

Answer to this question. 回答这个问题。 Google App Engine will not let this work. Google App Engine不允许这样做。 I gave it up and used a different cloud provider , because life's too short, and python should be python, anywhere. 我放弃了它,使用了其他的云提供商 ,因为生命太短了,python在任何地方都应该是python。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google App Engine后端Python - Google App Engine Backend Python 使用Google App Engine实现“Start with with”和“Ends with”查询 - Implementing “Starts with” and “Ends with” queries with Google App Engine 从Google App Engine上的异步urlfetch开始后端 - Start backend with async urlfetch on Google App Engine Google App引擎将延迟添加到后端 - Google App engine Add defer to backend Google App Engine任务队列后端Python - Google App Engine Task Queue Backend Python Google App Engine 实例关闭并重复启动 - Google App Engine instance shuts down and starts repeatedly Google App Engine:路由和细分应用后端的最佳实践(Python) - Google App Engine: Best practice for routing and segmenting an app backend (Python) Google App Engine的“后端API版本”和“ App版本”之间的区别 - Difference Between “Backend API Version” and “App Version” for Google App Engine Google App Engine python作为后端,而angular js作为前端的移动网络 - google app engine python as backend and angular js as frontend for mobile web 正则表达式在python和Google应用程序脚本中的区别(与后端引擎相关?) - Difference of regex in python and google app script (backend engine related?)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM