Multithreating producent-consumer solution
Project description
queuing
Multithreating producent-consumer solution
Example
import queuing
import time
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s [%(levelname)5s] %(name)s %(message)s')
@queuing.consumer(instances=5)
def m1(no):
time.sleep(1)
print("m1 {}".format(no))
queuing.broker.send('m2', {
'no': no,
'sqno': no * no,
})
[queuing.broker.send('m3', {
'no': no,
}) for i in range(0, 10)]
@queuing.consumer(instances=2)
def m2(no, sqno):
time.sleep(2)
print("m2 {} {}".format(no, sqno))
@queuing.consumer(instances=1)
def m3(no):
print("m3 {}".format(no))
if __name__ == '__main__':
for i in range(0, 10):
queuing.broker.send('m1', {
'no': i
})
queuing.broker.loop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
queuing-0.3.1.tar.gz
(2.2 kB
view details)
Built Distribution
File details
Details for the file queuing-0.3.1.tar.gz
.
File metadata
- Download URL: queuing-0.3.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2e846d8febcad5f507539f6efcc1c239e222c99c978943c06028fddb1d8c15e |
|
MD5 | 07e158baf2caf85e1874fe3da60e9709 |
|
BLAKE2b-256 | 76263a1d19f2165e45d90bfce9123dd9044d8893b2fba65abe29f0520c1d9866 |
File details
Details for the file queuing-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: queuing-0.3.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23cae7d63a7149857844f7c23556a4d63f28fe4566c72c5c0e6fe8cde2853b0c |
|
MD5 | 90ade6e0e7d1e29b50e489036444cf37 |
|
BLAKE2b-256 | 6f74c28adce5334eb00347c061f670773f3c18d9f579dce72609c0515487b16d |