Pergunta

I have a class that does a complex calculation for me. The actual calculation does not take that long, but getting an instance of the class takes about a second. (It reads in a bunch of large-ish data files.)

Is there a way that I can create an instance of this class, and then have my RQ worker re-use it, rather than having to re-initialize it for each job that I execute?

Foi útil?

Solução

duh. I missed it in the documentation: http://python-rq.org/docs/workers/

Under "performance notes", it even gives sample code to help with this problem

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top