I’m trying to initiate a dynamic backend using a cron task, however after I deploy I don’t see the new cron task under the cron tab and also I don’t see any instances of backends under my backend tab. What am I doing wrong?
EDIT: Now the cron job runs properly (after I changed the schedule to “every 1 minutes”. However the backend refuses to run. The cron tab says on time Failed. Maybe I need to define some handler in my app.yaml or something like that?
EDIT2: After using appcfg to update the backends list I can see the backend I defined under backends tab. Now I just have to wait and see if it works (does anybody know of a way to make a get request to the backend with the browser? I don’t want to wait an hour just to see if it’s running (the cron task runs every hour now).
My code
My cron.yaml file:
cron:
- description: crawler backend activation
url: /crawl
target: crawler
schedule: every minute
My backends.yaml file:
backends:
- name: crawler
class: B1
instances: 1
start: crawler.application
options: dynamic
My backend handler crawl.py:
import logging
import webapp2 as webapp
class Handler(webapp.RequestHandler):
logging.debug('crawler started')
application = webapp.WSGIApplication([('/crawl', Handler)])
I see a couple of problems with your code. First, your startup handler is called
crawl.py, but yourbackends.yamlrefers tocrawler.py. Second, the startup handler specified inbackends.yamlonly specifies the handler file for the start request – all other requests, such as those created by cron, go throughapp.yamland are routed to handlers like regular requests.