質問

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?

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top