Skip to content
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

added_multiprocessing #26

Merged
15 changes: 9 additions & 6 deletions Scrapper-Service/process/mutiprocessing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from utility import get_logger , print_start

from multiprocessing import Process
## TO_DO
## 1. Add multiprocessing from the reference implementation
## 2. Use Logging at properplaces for generating logs from the context manager
Expand All @@ -10,16 +10,19 @@ def __init__(self , log_level , log_stream):
inside threads
"""
self.logger = get_logger(__name__ , log_level , log_stream)

pass
self.process_list=[]
def __execute__(self , runnable):
runnable()
pass
p= Process(target= runnable)
self.process_list.append(p)
p.start()

def __enter__(self):
return self.__execute__

def __exit__(self , exception_type, exception_value, traceback):
pass
for process in self.process_list:
process.join()


## A HELPER IMPLEMENTATION
# class MultiPoc:
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.