29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
xProcessPoolExecutor = None
def initExecutor (nMultiCPU=None):
"process pool executor initialisation"
global xProcessPoolExecutor
nMaxCPU = max(os.cpu_count()-1, 1)
if nMultiCPU is None or not (1 <= nMultiCPU <= nMaxCPU):
nMultiCPU = nMaxCPU
print("CPU processes used for workers: ", nMultiCPU)
xProcessPoolExecutor = concurrent.futures.ProcessPoolExecutor(max_workers=nMultiCPU)
|
>
>
>
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
xProcessPoolExecutor = None
def initExecutor (nMultiCPU=None):
"process pool executor initialisation"
global xProcessPoolExecutor
if xProcessPoolExecutor:
# we shutdown the ProcessPoolExecutor which may have been launched previously
xProcessPoolExecutor.shutdown(wait=False)
nMaxCPU = max(os.cpu_count()-1, 1)
if nMultiCPU is None or not (1 <= nMultiCPU <= nMaxCPU):
nMultiCPU = nMaxCPU
print("CPU processes used for workers: ", nMultiCPU)
xProcessPoolExecutor = concurrent.futures.ProcessPoolExecutor(max_workers=nMultiCPU)
|
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
# Python version
print("Python: " + sys.version)
# Grammalecte
echo("Grammalecte v{}".format(oGCE.version))
oGCE.displayOptions()
# Process Pool Executor
if xProcessPoolExecutor:
# If the module is imported and main() launched, we must shutdown the ProcessPoolExecutor
# which has been launched previously
xProcessPoolExecutor.shutdown(wait=False)
initExecutor(nMultiCPU)
# Server (Bottle)
run(app, host=sHost, port=nPort)
if __name__ == '__main__':
xParser = argparse.ArgumentParser()
|
<
<
<
<
|
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
# Python version
print("Python: " + sys.version)
# Grammalecte
echo("Grammalecte v{}".format(oGCE.version))
oGCE.displayOptions()
# Process Pool Executor
initExecutor(nMultiCPU)
# Server (Bottle)
run(app, host=sHost, port=nPort)
if __name__ == '__main__':
xParser = argparse.ArgumentParser()
|