Grammalecte  Check-in [4c1d92adc4]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

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:4c1d92adc4a552702e5ad60e25f4a13e3a4ed7ed69e1c278decdc2af68ceca47
User & Date: olr 2019-08-14 13:06:21
Context
2019-08-14
14:04
[fr] ajustements check-in: 6433234f4a user: olr tags: fr, trunk
13:06
[server] always shutdown ProcessPoolExecutor before launching it check-in: 4c1d92adc4 user: olr tags: server, trunk
10:19
[fr] ajustements check-in: 4d3729573f user: olr tags: fr, trunk
Changes

Changes to grammalecte-server.py.

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