Overview
Comment: | [server] always shutdown ProcessPoolExecutor before launching it |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | server |
Files: | files | file ages | folders |
SHA3-256: |
4c1d92adc4a552702e5ad60e25f4a13e |
User & Date: | olr on 2019-08-14 13:06:21 |
Other Links: | manifest | tags |
Context
2019-08-14
| ||
14:04 | [fr] ajustements check-in: 6433234f4a user: olr tags: trunk, fr | |
13:06 | [server] always shutdown ProcessPoolExecutor before launching it check-in: 4c1d92adc4 user: olr tags: trunk, server | |
10:19 | [fr] ajustements check-in: 4d3729573f user: olr tags: trunk, fr | |
Changes
Modified grammalecte-server.py from [c3315b73a8] to [800ce882b1].
︙ | ︙ | |||
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 | # Python version print("Python: " + sys.version) # Grammalecte echo("Grammalecte v{}".format(oGCE.version)) oGCE.displayOptions() # Process Pool Executor | < < < < | 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() |
︙ | ︙ |