I'm not sure whether this is a design decision or a limitation, but I find it quite odd. Basically, workers=1 does not setup any worker, and workers=2 sets up 2 workers. This is, at the very least, inconsistent and confusing.
If there is no underlying limitation, I would like to propose a change, because I think there are important use cases for having a single worker (apart from the main process).
Consider an online API with rate limitation. Say that we are downloading information using methods A and B from that API, with different rate limits, so that A provides some info to use with B. The most straightforward way to implement this would be to manage method A in the main process, taking into account rate limits for A, and send jobs to a single worker that would manage method B and its rate limitations. Note that, with several workers, there may be race conditions, and things gets quite more complicated to avoid crashes.
I'm not sure whether this is a design decision or a limitation, but I find it quite odd. Basically,
workers=1does not setup any worker, andworkers=2sets up 2 workers. This is, at the very least, inconsistent and confusing.If there is no underlying limitation, I would like to propose a change, because I think there are important use cases for having a single worker (apart from the main process).
Consider an online API with rate limitation. Say that we are downloading information using methods A and B from that API, with different rate limits, so that A provides some info to use with B. The most straightforward way to implement this would be to manage method A in the main process, taking into account rate limits for A, and send jobs to a single worker that would manage method B and its rate limitations. Note that, with several workers, there may be race conditions, and things gets quite more complicated to avoid crashes.