2014-01-06 35 views
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 

我覺得我設置正確...和版本號匹配..我錯過了什麼?謝謝!

+0

你怎麼開始dev_server.py,你可以發佈CMD行參數? – alex

+0

下面是我如何啓動我的服務器: dev_appserver.py [appname] /app.yaml [appname] /loadandprocess.yaml [appname] /dispatch.yaml – user3058197

回答

0

在本地運行的應用程序,同時指定.yaml文件dev_appserver.py

dev_appserver.py -A your-app-id application.yaml worker.yaml 
+0

檢查註釋 - 這已經是如何調用服務器(甚至更好, 'dispatch.yaml'文件也包含在內) –