django-q2 / django-q2

A multiprocessing distributed task queue for Django based on Django-Q
https://django-q2.readthedocs.io
MIT License
390 stars 38 forks source link

Filter tasks through Result or Args in queryset #205

Open ThomasDeudon opened 3 months ago

ThomasDeudon commented 3 months ago

I would need to filter down tasks depending on the string representation of their result / args.

I tried the "result__icontains" but it's refused and Casting it as a Charfield but it's giving me a token for both result and args.

GDay commented 3 months ago

That's not really possible. Both the args and result are pickled.

You have two options:

  1. Iterate over all tasks and get the unpickled value and then compare. This is likely not efficient though.
  2. Pickle your current string and use that to search with. You would probably only be able to search for the entire text though and not partially as those would likely results in a completely different base64 string.