Flask: passing around background worker job (rq, redis)

后端 未结 2 1815
后悔当初
后悔当初 2021-02-06 07:06

I want to do a very simple thing: Launch a worker to something and then return the answer to user. I\'m trying to do so using a combination of Flask and RQ.

impo         


        
2条回答
  •  盖世英雄少女心
    2021-02-06 07:32

    Problem with serializing arguments (you actually trying to serialize function object which is impossible with pickle).

    Try

    @app.route('/make/')
    def make():
        job = q.enqueue(func=do_something, args=('argument',))
        session['job'] = job
        return 'Done'
    

提交回复
热议问题