It is possible to stop the worker from running by using the stop method. The supervisor receives the request, and will never spawn a new worker instead. A worker uses this method when there is no solution to a problem. Using this method in conjunction with on_starvation is a good example of how it should be used. If a worker is starving and there are not enough tasks available to consume, it can be intentionally stopped to reduce the load on the queue. By calling stop, all the workers under a specific supervisor will stop as well.
When the worker is interrupted by a SIGTERM, the signal handler invokes the stop function to interrupt the worker's workflow.