[Python] I am using celery chunks and getting this error TypeError: worker.square_batch()...

Discussão em 'Python' iniciado por Stack, Junho 6, 2025.

  1. Stack

    Stack Membro Participativo

    TASK DEFINED

    @celery_app.task(base=DefaultTask)
    def square_batch(k):
    return [x*x for x in k]
    # return [x * x for [x] in k]



    CALLING TASK

    @app.get("/chunk")
    def cnk():
    data=(range(100))
    job=square_batch.chunks(data,10)
    task=job.apply_async()
    return {"task submitted with id":task.id}


    Expecting 10 results each task returning list of squares

    Continue reading...

Compartilhe esta Página