4

I use celery, with python 3 and supervisor in Ubuntu.

I've been working to make a new API, which will get an image from the internet using PIL(Pillow) and save it in a server.

However the problem is that I use Celery as scheduler and in the original API it returns the result in a milisecond, but when I use PIL, the wait becomes almost a second.

So as a solution, I am looking for a way to make the Celery worker run in the background.

Is it possible?

Benno
  • 5,640
  • 2
  • 26
  • 31
  • Is PIL used inside your API handler or in the function that is run by celery worker? – avichalp Mar 14 '17 at 00:16
  • @avichalp yes, run by celery –  Mar 14 '17 at 00:19
  • @avichalp so since api does not perform in background, I have to call celery forcely and make it work in background, I wonder force call to celery is possible. –  Mar 14 '17 at 00:45
  • i do not understand. Celery is already running in background in the scenario that you described. What else do you want? – avichalp Mar 14 '17 at 04:07

1 Answers1

4

What you probably want is to daemonize your Celery worker.

If you follow the steps provided in the Celery running the worker as a daemon documentation you will be able to do that.

It is a bit of a complicated process, but it will allow the Celery worker to run in the background

John Moutafis
  • 22,254
  • 11
  • 68
  • 112