March 2019
Beginner
490 pages
12h 40m
English
The multiprocessing module is an alternative to using the threading module. It is a module that's similar to the threading module, which offers a very similar interface, but at a low level. It works with processes instead of threads. In this case, we will take a similar approach to concurrent.futures. We are establishing a multiprocessing pool and presentation of tasks by assigning a function to the address list.
You can find the following code in the demo_multiprocessing.py file:
#!/usr/bin/python3import timeimport multiprocessingimport loggingimport requestsfrom utils import check_websitefrom utils import WEBSITE_LISTNUM_WORKERS = 3if __name__ == '__main__': start_time = time.time() with multiprocessing.Pool(processes=NUM_WORKERS) ...
Read now
Unlock full access