Grammalecte  Check-in [12e5ec42ba]

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

Overview
Comment:[server] init ProcessPoolExecutor for WSGI servers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | server
Files: files | file ages | folders
SHA3-256:12e5ec42bab9e3312fcb588e84fcd4193ba7549377d1c68e53fdc7bedf94bec8
User & Date: olr 2019-08-14 09:51:35
Context
2019-08-14
10:19
[fr] ajustements check-in: 4d3729573f user: olr tags: fr, trunk
09:51
[server] init ProcessPoolExecutor for WSGI servers check-in: 12e5ec42ba user: olr tags: server, trunk
2019-08-12
15:01
[fr] faux positif check-in: fcff10f544 user: olr tags: fr, trunk
Changes

Changes to grammalecte-server.py.

   316    316   
   317    317       # Python version
   318    318       print("Python: " + sys.version)
   319    319       # Grammalecte
   320    320       echo("Grammalecte v{}".format(oGCE.version))
   321    321       oGCE.displayOptions()
   322    322       # 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)
   323    327       initExecutor(nMultiCPU)
   324    328       # Server (Bottle)
   325    329       run(app, host=sHost, port=nPort)
   326    330   
   327    331   
   328    332   if __name__ == '__main__':
   329    333       xParser = argparse.ArgumentParser()
................................................................................
   345    349               dOpt.update({ opt:False  for opt in xArgs.opt_off })
   346    350   
   347    351       main(xArgs.host or "localhost", \
   348    352            xArgs.port or 8080, \
   349    353            dOpt,
   350    354            xArgs.test_page,
   351    355            xArgs.multiprocessor)
          356  +else:
          357  +    # we do it for the server may be used with WSGI (which doesn’t call main())
          358  +    # WSGI servers just import the given file as a module and use an object exported from it (<app> in this case) to run the server.
          359  +    initExecutor()