Hi Andreas, So you are trying to keep a task from simultaneously executing multiple times? One thing to note is that, even with names, it is possible for a task to simultaneously run more than once.
If possible I would suggest 'keying' the task names. So if you are currently trying to start a task named 'do-some-stuff', the next run would be 'do-some-stuff-2', and so on. You can tell if a task is sitting in the queue versus already run by the exception raised: TaskAlreadyExists indicates it is on the queue, TombstonedTask indicates it has already run. http://code.google.com/appengine/docs/python/taskqueue/exceptions.html Without knowing what / how the tasks are generated it is hard to suggest much more. Robert On Wed, Nov 3, 2010 at 08:11, andreas schmid <[email protected]> wrote: > my usecase is: > - add a task in the queue, its not in there yet so it gets added > - another process needs to add a task with the same logic, it finds the task > (which didnt run) already in queue and returns. > - the task runs. > - another process adds this task again.... > > what i want to achieve is to avoid having a task twice in a queue. i tried > setting names based on datetime objects but but the only thing i get is that > i cant add a task the same task the same minute or another time period. > > > On Nov 2, 2010, at 11:38 PM, Robert Kluin wrote: > >> It is good that it is not possible. Otherwise you could not use this >> feature to prevent fork bombs and you would need to implement the same >> thing yourself. >> >> If you do not need that feature, do not name the task. Or, name the >> task but if you get a tomb-stoned task error, increment the task's >> name and try to enqueue it again. >> >> >> >> Robert >> >> >> >> >> >> >> On Tue, Nov 2, 2010 at 10:49, andreas schmid <[email protected]> wrote: >>> hi, >>> >>> >>> i don't really understand why a task name has to be unique forever on my >>> app. >>> i think it would be a lot better if a task can be add to a queue if its not >>> already in there and as soon as the task is done another process could add >>> it again with the same name. >>> >>> or am i doing something wrong in my app and this is possible? >>> >>> -- >>> 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. >>> >>> >> >> -- >> 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. >> > > -- > 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. > > -- 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.
