1
我在加載我的GAE模塊時遇到問題。如何從cron作業加載基本模塊
我cron.yaml:
cron:
- description: call frontend instance to call module
url: /callLoadAndProcess
schedule: every day 01:00
timezone: America/New_York
然後我的app.yaml的相關部分:
- url: /callLoadAndProcess
script: callLoadAndProcess.application
secure: always
login: admin
現在我callLoadAndProcess.py:
import sys
import webapp2
import os
import urllib2
import logging
from google.appengine.api import modules
class callLoadAndProcess(webapp2.RequestHandler):
def get(self):
modules.start_module("loadandprocess","1")
application = webapp2.WSGIApplication([('/callLoadAndProcess', callLoadAndProcess)],debug=True)
對於我的模塊,我有一個loadandprocess.yaml,它是:
application: [application name]
module: loadandprocess
version: 1
runtime: python27
instance_class: B4_1G
basic_scaling:
max_instances: 1
handlers:
- url: /.*
script: loadAndProcess.application
login: admin
最後,loadAndProcess.py是我想要運行的後端模塊的腳本:
class loadAndProcess(webapp2.RequestHandler):
def get(self):
#DO STUFF
application = webapp2.WSGIApplication([('/loadAndProcess', loadAndProcess)],debug=True)
在我的開發服務器上,當我試圖通過運行管理頁面cron作業,我得到以下錯誤:
line 138, in _CheckAsyncResult
raise mapped_error()
InvalidVersionError
我覺得我設置正確...和版本號匹配..我錯過了什麼?謝謝!
你怎麼開始dev_server.py,你可以發佈CMD行參數? – alex
下面是我如何啓動我的服務器: dev_appserver.py [appname] /app.yaml [appname] /loadandprocess.yaml [appname] /dispatch.yaml – user3058197