You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
How can I use it with flower?
"create_task" works fine with flower, but I can't see "count_click" tasks on flower.
What could I do wrong?
It feels like I'm using wrong namespaces or starting arguments.
from .celeryimportcelery_appimporttimefromcelery_batchesimportBatches, SimpleRequestfromcollectionsimportCounter@celery_app.task(name="create_task")defcreate_task(task_type):
time.sleep(int(task_type) *2)
returnTrue@celery_app.task(base=Batches, flush_every=5, flush_interval=2)defcount_click(requests: list[SimpleRequest]):
"""Count the number of times each URL is requested."""count=Counter(request.kwargs["click"] forrequestinrequests)
forurl, countincount.items():
print(f">>> Clicks: {url} -> {count}")
forrequestinrequests:
celery_app.backend.mark_as_done(request.id, 'hi', request=request)
A working example would be appreciated.
The text was updated successfully, but these errors were encountered:
celery-batches unfortunately doesn't provide all the signals that normal Celery tasks do (see #33 for an example). I suspect this is why you're not seeing it appear properly in flower. Does flower have a list of signals it depends on?
Thinking a bit more about this, I wonder what the appropriate events to send are. For example if we call a task 30 times with a batch size of 10; should we report that each task request started, finished, etc. or should we only report each batch? I suspect the latter makes more sense.
Hello!
How can I use it with flower?
"create_task" works fine with flower, but I can't see "count_click" tasks on flower.
What could I do wrong?
It feels like I'm using wrong namespaces or starting arguments.
A working example would be appreciated.
The text was updated successfully, but these errors were encountered: