Grammalecte  Check-in [dccaa66ea5]

Overview
Comment:[server] multiprocessing option (accidental commit)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | server
Files: files | file ages | folders
SHA3-256: dccaa66ea57a6d7e92eca5e9650824545fc44421a38f602f759f36aee526bc5a
User & Date: olr on 2019-05-29 14:33:00
Original Comment: [server] use multiprocessing, + code clarification
Other Links: manifest | tags
Context
2019-05-29
14:55
[server] use multiprocessing option check-in: 1cbca91ea6 user: olr tags: trunk, server
14:33
[server] multiprocessing option (accidental commit) check-in: dccaa66ea5 user: olr tags: trunk, server
14:26
[server] use multiprocessing, + code clarification check-in: 7e1204782d user: olr tags: trunk, server
Changes

Modified grammalecte-server.py from [3e2816c646] to [567790a638].

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
19
20
21
22
23
24
25

26
27
28
29
30
31
32







-







from grammalecte.graphspell.echo import echo


#### GRAMMAR CHECKER ####

oGrammarChecker = grammalecte.GrammarChecker("fr", "Server")
oSpellChecker = oGrammarChecker.getSpellChecker()
oLexicographer = oGrammarChecker.getLexicographer()
oTextFormatter = oGrammarChecker.getTextFormatter()
oGCE = oGrammarChecker.getGCEngine()


xProcessPoolExecutor = None


293
294
295
296
297
298
299
300

301
302
303
304
305
306
307
292
293
294
295
296
297
298

299
300
301
302
303
304
305
306







-
+







    except KeyError:
        traceback.print_exc()
        return False


#### START ####

def main (sHost="localhost", nPort=8080, dOptions=None, bTestPage=False):
def main (sHost="localhost", nPort=8080, dOptions=None, bTestPage=False, nMultiProc=None):
    "start server"
    global TESTPAGE
    global HOMEPAGE

    if bTestPage:
        TESTPAGE = True
        HOMEPAGE = HOMEPAGE.replace("{SERVER_PORT}", str(nPort))
316
317
318
319
320
321
322

323
324
325
326
327
328
329
330
331
332
333
334


335
336
337
338
339


315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340

341
342







+












+
+




-
+
+


if __name__ == '__main__':
    xParser = argparse.ArgumentParser()
    #xParser.add_argument("lang", type=str, nargs='+', help="lang project to generate (name of folder in /lang)")
    xParser.add_argument("-ht", "--host", help="host (default: localhost)", type=str)
    xParser.add_argument("-p", "--port", help="port (default: 8080)", type=int)
    xParser.add_argument("-mp", "--multiprocessor", help="define how many processes for the grammar checker", type=int)
    xParser.add_argument("-t", "--test_page", help="page to test the server on /", action="store_true")
    xParser.add_argument("-on", "--opt_on", nargs="+", help="activate options")
    xParser.add_argument("-off", "--opt_off", nargs="+", help="deactivate options")
    xArgs = xParser.parse_args()

    dOpt = None
    if xArgs.opt_on  or  xArgs.opt_off:
        dOpt = {}
        if xArgs.opt_on:
            dOpt = { opt:True  for opt in xArgs.opt_on }
        if xArgs.opt_off:
            dOpt.update({ opt:False  for opt in xArgs.opt_off })

    print(xArgs.multiprocessor)

    main(xArgs.host or "localhost", \
         xArgs.port or 8080, \
         dOpt,
         xArgs.test_page)
         xArgs.test_page,
         xArgs.multiprocessor)