views:

426

answers:

2

In Task Queues code is executed to connect to the server side through URL Fetch. My file queue.yaml.

queue: 
- Name: default 
   rate: 10 / m 
   bucket_size: 1

In such settings, Tusk performed all at once, simultaneously. Specificity is that between the requests should be delayed at least 5 sec. Task must perform on stage with a difference> 5 sec. (but does not parallel).

What are the values set in queue.yaml?

+3  A: 

You can't specify minimum delays between tasks in queue.yaml, currently; you should do it (partly) in your own code. For example, if you specify a bucket size of 1 (so that more than one task should never be executing at once) and make sure the tasks runs for at least 5 seconds (get a start=time.time() at the start, time.sleep(time.time()-(5+start)) at the end) this should work. If it doesn't, have each task record in the store the timestamp it finished, and when it start check if the last task ended less than 5 seconds ago, and in that case terminate immediately.

Alex Martelli
+1  A: 

The other way could be store the task data in table. In your task-queue add a id parameter. Fetch 1st task from table and pass its id to task queue processing servlet. In servlet at the end delay for 5 second and feth next task, pass its id and.... so on.

Manjoor