App Engine后端实例超时(Python)

时间:2014-02-20 19:54:55

标签: python google-app-engine

目前我正在为我的网站使用动态后端实例,但我仍然遇到超时问题。我网站的背景是:

  1. GAE用作处理用户请求的前端。
  2. 请求将被发送到EC2休息服务器(使用bottle)进行处理。
  3. 以下是GAE日志中的错误信息。似乎GAE在60秒后停止了我的后端线程。我很感激任何建议。

    ERROR    2014-02-20 14:42:18,365 module.py:660] Request to '/_ah/background' failed
    Traceback (most recent call last):
      File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\module.py", line 637, in _handle_request
        environ, wrapped_start_response)
      File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\request_rewriter.py", line 311, in _rewriter_middleware
        response_body = iter(application(environ, wrapped_start_response))
      File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\module.py", line 1524, in _handle_script_request
        request_type)
      File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\module.py", line 1476, in _handle_instance_request
        request_id, request_type)
      File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\instance.py", line 382, in handle
        request_type))
      File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\http_runtime.py", line 244, in handle
        response = connection.getresponse()
      File "C:\Python27\Lib\httplib.py", line 1045, in getresponse
        response.begin()
      File "C:\Python27\Lib\httplib.py", line 409, in begin
        version, status, reason = self._read_status()
      File "C:\Python27\Lib\httplib.py", line 365, in _read_status
        line = self.fp.readline(_MAXLINE + 1)
      File "C:\Python27\Lib\socket.py", line 476, in readline
        data = self._sock.recv(self._rbufsize)
    error: [Errno 10054] An existing connection was forcibly closed by the remote host
    

    的app.yaml

    - url: /backend.html
      script: przm_batchmodel.py
    

    backends.yaml

    backends:
    - name: mybackend
      class: B1
      instances: 1
      options: dynamic
    

    Output.py

    def loop_html(thefile):
        ####do some thing###
        response = urlfetch.fetch(url=my_REST_server_URL, payload=data, method=urlfetch.POST, headers=http_headers, deadline=6000)   
        return response
    
    class przmBatchOutputPage(webapp.RequestHandler):
        def post(self):
            form = cgi.FieldStorage()
            thefile = form['file-0']
            html = background_thread.BackgroundThread(target=loop_html, args=[thefile, generate_batch_jid()])
            html.start()
            self.response.out.write(html)
    
    app = webapp.WSGIApplication([('/.*', przmBatchOutputPage)], debug=True)
    

0 个答案:

没有答案