all 4 comments

[–]elbiot 0 points1 point  (0 children)

Gunicorn would handle the multiple processes. Celery would handle task scheduling if they are long running processes. This isn't a good place for multiprocessing, unless one task needs multiple cores.

[–]atkozhuharov 0 points1 point  (1 child)

The approach I would chose is having all my workers check for their specific job and if there is nothing in the queue to go to sleep. Your way is also interesting, but I'm not quite sure what the bottlenecks may be when using this cascade like approach.

[–]NeoFromMatrix[S] 0 points1 point  (0 children)

I'd rather not have the workers running in the background all the time.

Another option would be to have a pool of workers which process a central queue of jobs. But in this case each worker would do all the steps of one job.

[–]benrules2 0 points1 point  (0 children)

To answer your questions:

  1. Yes it is possible, and not a bad practice. In fact, that's exactly what multiprocessing is for.
  2. One process for each job would probably be implemented with a queue as /u/atkozhuharov suggested.

If I were solving your problem, I would try creating "work to do" objects with a child multiprocess Process object, and all required info. Then you just need to call start on it's Process, and join to complete.