25 Initialize the service and return the entry point. |
25 Initialize the service and return the entry point. |
26 |
26 |
27 @return the entry point for the background client (function) |
27 @return the entry point for the background client (function) |
28 """ |
28 """ |
29 path = __file__ |
29 path = __file__ |
30 for i in range(4): |
30 for _ in range(4): |
31 path = os.path.dirname(path) |
31 path = os.path.dirname(path) |
32 sys.path.insert(2, os.path.join(path, "ThirdParty", "Jasy")) |
32 sys.path.insert(2, os.path.join(path, "ThirdParty", "Jasy")) |
33 return jsSyntaxCheck |
33 return jsSyntaxCheck |
34 |
34 |
35 |
35 |
112 initialTasks = 2 * NumberOfProcesses |
112 initialTasks = 2 * NumberOfProcesses |
113 for task in argumentsList[:initialTasks]: |
113 for task in argumentsList[:initialTasks]: |
114 taskQueue.put(task) |
114 taskQueue.put(task) |
115 |
115 |
116 # Start worker processes |
116 # Start worker processes |
117 for i in range(NumberOfProcesses): |
117 for _ in range(NumberOfProcesses): |
118 multiprocessing.Process(target=worker, args=(taskQueue, doneQueue))\ |
118 multiprocessing.Process(target=worker, args=(taskQueue, doneQueue))\ |
119 .start() |
119 .start() |
120 |
120 |
121 # Get and send results |
121 # Get and send results |
122 endIndex = len(argumentsList) - initialTasks |
122 endIndex = len(argumentsList) - initialTasks |
142 |
142 |
143 if i < endIndex: |
143 if i < endIndex: |
144 taskQueue.put(argumentsList[i + initialTasks]) |
144 taskQueue.put(argumentsList[i + initialTasks]) |
145 |
145 |
146 # Tell child processes to stop |
146 # Tell child processes to stop |
147 for i in range(NumberOfProcesses): |
147 for _ in range(NumberOfProcesses): |
148 taskQueue.put('STOP') |
148 taskQueue.put('STOP') |
149 |
149 |
150 |
150 |
151 def worker(inputQueue, outputQueue): |
151 def worker(inputQueue, outputQueue): |
152 """ |
152 """ |