How to submit non-blocking job in Gearman?

243 views Asked by At

I want to use result = gearman_client.submit_job("reverse_task", "Hello World!", wait_until_complete=False) to submit a non-blocking job to Gearman Job Server. However, result.state is always 'CREATED', and result.complete is always False. If I change wait_until_complete to True, then everything goes right. That's so wired. Can anyone help?

1

There are 1 answers

0
expoter On

As python-gearman described here, you should use gearman_client.wait_until_jobs_completed([result]) to wait until all jobs completed, rather than checking result.complete in a while loop.