#NEWLINE# def __init__( self , worker_cls , num_workers = 2 ) : #NEWLINE# #INDENT# if ( not ( inspect . isclass ( worker_cls ) and issubclass ( worker_cls , multiprocessing . Process ) ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Worker class must extend multiprocessing.Process' ) #NEWLINE# #UNINDENT# self . workers = [ ] #NEWLINE# self . num_workers = num_workers #NEWLINE# self . worker_cls = worker_cls #NEWLINE# self . running = False #NEWLINE# signal . signal ( signal . SIGINT , self . stop ) #NEWLINE# signal . signal ( signal . SIGTERM , self . stop )