windows - Issues with multiprocessing in python hosted in Apache -


i having issues running multiple processes in ptyhon on windows when hosted in wsgi/apache. same code works fine when running in flask self hosted environment running command prompt.

snippet calling method:

     # start processer         print("before creating process")         p = process(target=self.worker, args=(task_reader, result_writer, pipeline_location_chunks[process_number],))         print("before starting process")          #p= process(target=self.testworker)         p.start() 

definition worker method

def worker(self, task_reader, result_writer, pipeline_locations):         """this method run each sub-process. when initialized loads share of         classifier pipelines memory , sends true start function inform         ready classification tasks"""         # load pipelines in dictionary category number key         print("in worker method")         pipelines = {}         pipeline_location in pipeline_locations:             category = int(pipeline_location.strip('.p'))             pipelines[category] = pickle.load(open(self.pipeline_dir + pipeline_location, 'rb+'))          # inform start function process's pipelines done loading         print("before sending")         result_writer.send(true)          # wait tasks. if new task (sent classify function) received,         # run each pipeline's decision function , append list of results         # send classify function         while true:             # tasks (if any) process's task queue. if there none, process's             # flow blocks here until there task available             new_task = task_reader.recv()             print("after receiving")             results = []             category, pipeline in pipelines.items():                 result = pipeline.decision_function(new_task)                 tup = (category, result[0])                 results.append(tup)             # send list of results classify function             result_writer.send(results) 

when run code in apache, starts process not print first line added in worker method. have added logging intentionally verify multiprocessing working fine. please let me know how can make functional need deploy on production.

environment details: flask 0.11 python 3.5 apache 2.4.23 (64 bit)


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -