Cron job runs successfully on local development server but fails after deployed

48 views
Skip to first unread message

Kai Zhou

unread,
Sep 7, 2017, 3:41:52 AM9/7/17
to Google App Engine
I include a cron job in my app. The following is the cron.yaml:
cron:
- description: monitor the spot every 60 seconds
  url: /task/cron
  schedule: every 1 minutes

And here is the handler for "/task/cron":
class CronHandler(webapp2.RequestHandler):
    def get(self):
        courses = Course.query().fetch()
        for c in courses:
            sub, num, sec=c.key.id().split(",")
            task = taskqueue.add(url = '/task/monitor', queue_name='monitor-queue', params = {'sub':sub, 'num':num, 'sec':sec})

In the handler, a queue named "monitor-queue" is called. Here is my queue.yaml file:
queue:
- name: monitor-queue
  rate: 5/s
  bucket_size: 10

- name: notify-queue
  rate: 5/s
  bucket_size: 10

I ran my code in local development server successfully. But when I deploy my app, I get UnknownQueueError every time the cron job is executed. Here is a screenshot of the log:

Can anyone help me with this issue? Thanks!

George (Cloud Platform Support)

unread,
Sep 7, 2017, 1:46:49 PM9/7/17
to Google App Engine
Hello Zhou, 

None of your two projects seem to have a task queue; no queue is visible in the Developers' Console.  Without a queue, you get the "UnknownQueueError" error message. 

You may try deploying the queue config explicitly. Otherwise you can use the gcould app deploy <path_to_your_queue.yaml> command. 

Kai Zhou

unread,
Sep 8, 2017, 10:29:51 PM9/8/17
to Google App Engine
Thanks George! This is just the problem. 
Reply all
Reply to author
Forward
0 new messages