I was playing with Goole App Engine Task Queue API to learn how to use it. But I couldn't make it trigger locally. My application is working like a charm when I upload to Google servers. But it doesn't trigger locally. All I see from the admin is the list of the tasks. But when their ETA comes, they just pass it. It's like they runs but they fails and waiting for the retries. But I can't see these events on command line.
When I try to click "Run" on admin panel, it runs successfuly and I can see these requests from the command line. I'm using App Engine SDK 1.3.4 on Linux with google-app-eng开发者_如何学Goine-django. I'm trying to find the problem from 3 hours now and I couldn't find it. It's also very hard to debug GAE applications. Because debug messages do not appear on console screen.
Thanks.
The development server won't run tasks automatically, you have to set them off yourself. It's a design feature, so you can see what happens when you run them, instead of them running at any point.
Essentially, there's nothing wrong with your application, it's a feature of development server.
The local devserver does support now queues. The trick with modules in local development is that instead of having different domain names, the deploy to localhost on different (dynamic) ports. What you need to do when you send a task to a queue you need to add the host the queue is listening on as well as the queue URL. Here's a Java example (sorry). Python has a similar method:
ModulesService moduleService = ModulesServiceFactory.getModulesService();
String hostNameToQuery = moduleService.getVersionHostname("worker_module_name", null);
logger.info("hostNameToQuery=" + hostNameToQuery);
TaskOptions options = TaskOptions.Builder
.withUrl("/workerQueueURL")
.header("Host", hostNameToQuery)
.param("taskKey", taskKeyString)
.retryOptions(RetryOptions.Builder.withTaskRetryLimit(0));
Let me know if this worked for you.
精彩评论