1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] GAE List tasks that start with a name?

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    When I add a queue, I give it an unique name, like longprocess-{id}-{timestamp}. ID is the id in the database for that entry to work, and the timestamp ensure I don't have colliding names in the queue.

    The issue is that the user can stop/resume the longprocess if he wants, so in the stop request, I'd like to list all tasks that starts with longporcess-1 (for {id} = 1), and stop all of them (expected 1 entry).

    I can target a task with :

    q = taskqueue.Queue('longprocess')
    q.delete_tasks(taskqueue.Task(name='longprocess-{0}'.format(longprocess.id,)))


    But of course, this doesn't work because the name is incorrect (missing it's -{timestamp} part).

    Is there something like a q.search('longprocess-1-*') that I would loop over and delete ?

    Continue reading...

Compartilhe esta Página