How can I make celery die after there are no more tasks to be run?
<p>I have a celery task that is memory-intensive and I want it to run in an expensive AWS server that stays off most of the time.</p>

<p>A celery beat will schedule the task once a day, but it can also be scheduled manually through a web application (== django).</p>

<p>Scheduling the task is a matter of sending a message to a rabbit queue.</p>

<p>Then I would like to issue a command using AWS api to turn on my expensive server, and have it start the workers, 
wait for them to die after there are no more tasks, and shutdown (and save some money because the server is off).</p>

<p>I know how to script AWS to turn on my server. The problem is: how do I tell celery to run tasks until the queue is empty <strong>and then die</strong>?</p>

<p>Is there a command parameter I can give it, or do I need to come up with some kind of hack for that?</p>