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
30
31
32
33
34
35



36
37
38
39
40
41
42
...
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333

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)


................................................................................

    # 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()







>
>
>







 







<
<
<
<







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
...
319
320
321
322
323
324
325




326
327
328
329
330
331
332

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)


................................................................................

    # 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()