New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Job picked from queue with default serializer while worker has json serializer #1357
Comments
Are you initializing |
+1 for this. I'm using the worker cli and need to migrate to JSON. I started looking at creating a PR to update the worker cli, but now I'm thinking it might be easier to add something to defaults.py and then add that to the worker cli? For example: |
Changing the default serializer to json would break RQ for many users so it's not an option at this point. I'd be happy to accept a PR that adds |
I've encountered this issue as well while working on trying to use a custom serializer with json. @nathanielweinman and I found that the default serializer was being used for jobs pulled off a queue due to the serializer not being passed as an argument when fetching jobs, the changes in #1381 worked for our purposes. As an aside, the use case of the custom serializer was to pull RQ jobs off of Redis and process them in Ruby. Encountered two issues with that:
|
Hello @JackBoreczky @nathanielweinman I'm trying to do the same as you but the other way around, queu jobs in Ruby and run them with python. How did you set up your python code? I'm using your PR version of RQ but I'm not being able to run it. main.py
print_url.py
I'm getting a |
@CarlosUvaSilva Are you testing using that setup for the pickle serializer? I tried something similar out myself and got the same error, but it went away with passing |
@JackBoreczky hey again, I couldn't get it to work anyway I tried (I even tried your PR but the use case is the inverse of yours so it didn't work). I ended up forking and monkey patching the |
I configured the worker and queue with
serializer=json
but when the job is picked from the queue it tries to de-serialize with pickle and I get pickle errors.I added some logging: At startup you can see the json serializer, but when the job is processed, the queue and job have a default serializer.
I could fix it by passing the
serializer=self.serializer
form the worker to the queue and job via thedequeue_any
class method indequeue_job_and-maintain_ttl
.Is this a bug with the json serializer, or was my setup wrong?
The text was updated successfully, but these errors were encountered: