Comments (3)
Thank you for your response. But I already figure out the problem and even forget how =)) Sory did not close this issue earlier.
Have a nice day
from sqs-workers.
Hi there 🙂 I happened to have encountered the same problem as originally mentioned (TypeError: cannot pickle 'module' object
)
I was wondering if you had any ways of helping to figure this out, whether it's an issue with my environment or implementation?
So far I've tried the minimal code mentioned in #16 (comment) and it still produces the problem. It's possible to avoid this with multiprocessing.set_start_method("fork")
however that seems to present other issues affecting stability (at least for me, on this mac)
Calling something like this from the python repl (based on what the process_queues
implementation does) will also produce the exception, I'm just at the limits of where to look further into detail as a relative newbie to python.
>>> import pickle
>>> from queue_handlers import sqs
>>> fn = sqs.queue("email").process_queue
>>> fn
<bound method GenericQueue.process_queue of RawQueue(name='email', backoff_policy=<sqs_workers.backoff_policies.ExponentialBackoff object at 0x10d630710>, batching_policy=<sqs_workers.batching.NoBatching object at 0x10d5e6ad0>, processor=<function send_email at 0x10dcb91c0>)>
>>> pickle.dumps(fn)
...the computer screams into the void ...
TypeError: cannot pickle 'module' object
This is with sqs-workers = 0.5.11
on python 3.11
If you have any tips for investigating problems like this, I'd appreciate any pointers or direction!
Like the original reporter, I too hope you have (or are already having) a nice day 😄
from sqs-workers.
Hey @1k2s3v, sorry for the delay.
Which version of sqs-workers are you using?
Could you please try to split your code in 2 files:
# queue_handlers.py
from sqs_workers import SQSEnv, create_standard_queue
sqs = SQSEnv()
create_standard_queue(sqs, "emails")
queue = sqs.queue("emails")
@queue.processor("send_email")
def send_email(to, subject, body):
print('asd')
queue.add_job("send_email", to="[email protected]", subject="Hello world", body="hello world")
# processor.py
from queue_handlers import sqs
def run():
sqs.process_queues()
if __name__ == "__main__":
run()
and run python processor.py
?
from sqs-workers.
Related Issues (10)
- getresponse() got an unexpected keyword argument 'buffering' HOT 2
- Support for arbitrary SQS messages? HOT 2
- How well can sqs-workers scale? HOT 2
- Unexpected behaviour of .delay HOT 1
- Rather generic name for a package meant for one team HOT 1
- Wildcard dependency on werkzeug breaks sqs-workers
- New versions should be published to PyPI automatically HOT 1
- Take the queue url directly instead of its name HOT 1
- queue.add_job() does not send message to SQS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqs-workers.