On Mon, Nov 22, 2010 at 9:14 AM, Nick Johnson (Google) < [email protected]> wrote:
> Hi Ian, > > On Mon, Nov 22, 2010 at 11:10 AM, Ian Lewis <[email protected]> wrote: > >> While the task name thing should generally work, they don't provide a >> guarantee that inserting the task >> won't succeed more than once. >> > > A named task will never be duplicated - that's the point of task names - > though any task at all may be executed more than once. > It may not actually get added to the queue but the program getting a response that it succeeded might be bad for me. I suppose I can just log this and move on though. > Also, I don't particularly want to have to add a task to check if it is >> inserted. >> > > Supposing there was a way to check if a task exists, what would you do if > you perform the check and it does not exist? > Sure, I would probably insert the task but I would also want to know how many times the task was being kicked from the queue and/or be notified about it as it could indicate bugs or issues with the task queue. Not that I don't trust it but I'm trying to be as robust as possible here. I suppose that simply logging it when tasks can be inserted by the cron job would be the best solution if I used task names. > There is also the problem of tombstoning names, so I would need to come up >> with unique task names that >> could be computed by the cron job. >> >> >> http://code.google.com/appengine/docs/python/taskqueue/overview.html#Worker_URLs_and_Task_Names >> > > You should always do this anyway - naming your tasks after the time > interval or iteration number they're for - because doing otherwise > introduces race conditions. > Understood. I wasn't suggesting that it shouldn't be done if I use task names. If the task is guaranteed not to be duplicated then I could use the time the task was to be run in the name and calculate that in the cron job. A bit fragile but doable. I was worried about having to calculate the task name with the time interval in the cron job and possibly getting it wrong. -- Ian http://www.ianlewis.org/ -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
