czue / celery-progress

Drop in, configurable, dependency-free progress bars for your Django/Celery applications.
MIT License
473 stars 90 forks source link

This could benefit from documantation for how to use it with chord or group based workflows. #97

Closed mscout1 closed 5 months ago

mscout1 commented 2 years ago

I like this very much but my current use case involves a complex set of chains and chords. I want to monitor the progress of the workflow as a whole, not just one task of it.

For example:

@shared_task(bind=True)
def do_one_step(self, item):
    #do item
    #Progress + 1
    return item

@shared_task(bind=True)
def finalize(self, items)
    #do item
    #Progress finish
    return item

def start_it(items)
    # Progress Init with len(items) total size
    work = chord(group([do_one_step.si(item) for all in items]), finalize.s())
    work.apply_async()

I want to track the progress of the entire work graph. Is there a good way to do that with this library?

czue commented 2 years ago

I haven't run into this need and off the top of my head I'm not sure if there is any way to do what you want, given the ProgressRecorder is pretty coupled with the task instance.

Interested to hear if anyone else has any better suggestions though!

mscout1 commented 2 years ago

Thanks for getting back to me. I'm probably going to go with rolling my own in that case.

akornor commented 2 years ago

@mscout1 Hi! I also have a need for something like this. Do you mind sharing the approach you plan on using? Thank you!

czue commented 5 months ago

this should now be supported in the 0.4 release. https://github.com/czue/celery-progress?tab=readme-ov-file#working-with-groups