Python: prioritizing tasks and executing asynchronous tasks without blocking

I am using Gevent now, and I wanted to ask two questions:

  • Is there a way to perform specific tasks that will never be executed asynchronously (instead of using a lock in each of these tasks)
  • Is there a way to prioritize jobs in Gevent? Like a group of tasks that will be generated with low priority, which will be performed when all other tasks are performed. For example , two tasks that listen on different sockets when each of these tasks processes socket requests at different priorities

If this is not possible in Gevent, is there any other library that can be done?

Edit
Maybe celery can help me here?

+4
source share
1 answer

If you want to manage computing resources, Python-asynchronous libraries cannot help here, because AFAIK does not have a priority scheduler. All greenthreads are equal.

Task queues usually have a notion of priority, so Celery or Beanstalk is one way to do this.

() , , , , CPU, IO, / UNIX DGRAM. ad-hoc . , , , , .

+1

Source: https://habr.com/ru/post/1658309/


All Articles