Home > other >  Is there a way to keep track of triggered cloud task queues in Google app engine, so I can find out
Is there a way to keep track of triggered cloud task queues in Google app engine, so I can find out

Time:12-02

I have a use case which requires me to keep track if all the taskqueues triggered inside a loop are executed or not. Once ALL of the taskqueues are executed(ALL, not a few), only then I can proceed with the next phase of my task. I want to keep track of this in the code itself, not from the Cloud Tasks page in the console.

In this code, I am triggering the taskqueues in this way:-

for item in listA:
  execute taskqueue1


inside taskqueue1 function:-

for b in listB:
 execute taskqueue2

I need to find out if all the taskqueues in loops of listA and listB are completed. Is there a way to keep track of the statuses of all the triggered taskqueues?

All taskqueues are push queues.

CodePudding user response:

While reviewing Python documentation,I found a link that could help you with your case: https://realpython.com/intro-to-python-threading/

In this article, you can find the next topics:

  • What is a Thread ?
  • How to create threads and wait for them to finish
  • How to use a ThreadPoolExecutor
  • How to avoid race conditions
  • How to use the common tools that Python threading provides

If you are not sure whether you want to use Python threading, asyncio or multiprocessing, then you can check out Speed up your Python Program with Concurrency:

https://realpython.com/python-concurrency/

Here is also a Python Github repo tutorial that could be helpful: https://github.com/realpython/materials/tree/master/intro-to-threading

CodePudding user response:

There is an API that can list all the tasks in queue: list_tasks. But I am not sure if this includes the running tasks too.

  • Related