Open brakhane opened 5 months ago
Not really solving your issue, but something we did that might work as a workaround is that we don't pass Dataframes directly to Dramatiq (partially because my use case has massive Dataframes), but persist what we need to the DB, then only pass an id for a row and fetch it within the worker.
You may consider changing the message encoder from the default JSON to something more adequate (docs).
In this example, I’m using PickleEncoder. IMHO, the problem lies within the broker that doesn’t handle exceptions when comparing two messages for equality.
Even when doing something stupid like in this example, it should either handle it gracefully, or fail right away. As it currently is implemented, it seems to work at first, until more than one message is sent.
What OS are you using?
Windows 10
What version of Dramatiq are you using?
Version: 1.17.0
What did you do?
I ran into an issue where a dramatiq worker takes a DataFrame to do some processing, and when more than one message is in the queue, the broker raises an exception because MessageProxy's
__eq__
is comparing two messages containing the dataframe argument using==
which Pandas doesn't like.Reproducable example:
Starting workers with
dramatiq -t 1 -p 2 bug
(to avoid out of memory issues) and the main program withpython bug.py
results in the following exceptionImmediately followed by
What did you expect would happen?
I expected dramatiq to not raise an exception