我在加载 GAE 模块时遇到问题。
我的 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_appserver.py
的两个.yaml
文件:
dev_appserver.py -A your-app-id application.yaml worker.yaml