Grammalecte  Check-in [c1ecdfead1]

Overview
Comment:[build] code cleaning
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | build
Files: files | file ages | folders
SHA3-256: c1ecdfead16feb383f37c3759fb1061bd5e940d46e997503f422c7006ea9f97b
User & Date: olr on 2020-03-30 12:39:39
Other Links: manifest | tags
Context
2020-03-30
12:41
[misc] SublimeText syntax update check-in: 6c08bf85cd user: olr tags: trunk, misc
12:39
[build] code cleaning check-in: c1ecdfead1 user: olr tags: trunk, build
12:01
[build][fr] graphcode for action id and use multiprocess features for faster building check-in: 5cdb3649d7 user: olr tags: trunk, fr, build
Changes

Modified compile_rules_graph.py from [cd58fd7450] to [d5b25a4036].

544
545
546
547
548
549
550
551

552
553
554
555
556

557
558
559
560
561
562
563
564
565
566
567
568




569
570
571
572
573
574
575
576
577
578
579
580
581
544
545
546
547
548
549
550

551



552

553
554

555
556
557
558
559
560
561
562
563

564
565
566
567
568
569




570
571
572
573
574
575
576







-
+
-
-
-

-
+

-









-
+
+
+
+


-
-
-
-







            print("Unknown line at:", iLine)
            print(sLine)

    # processing rules
    print("  processing rules...")
    initProcessPoolExecutor()
    fStartTimer = time.time()
    nRule = 0
    # build graph
    dAllActions = {}
    sPyCallables = ""
    sJSCallables = ""
    lResult = []
    # buid graph
    nRule = 0
    for sGraphName, lRuleLine in dAllGraph.items():
        #dGraph, dActions, sPy, sJS = processing(sGraphName, dGraphCode[sGraphName], sLang, lRuleLine, dDef, dDecl, dOptPriority)
        nRule += len(lRuleLine)
        try:
            xFuture = xProcessPoolExecutor.submit(processing, sGraphName, dGraphCode[sGraphName], sLang, lRuleLine, dDef, dDecl, dOptPriority)
            lResult.append(xFuture)
        except (concurrent.futures.TimeoutError, concurrent.futures.CancelledError):
            return "Analysis aborted (time out or cancelled)"
        except concurrent.futures.BrokenExecutor:
            return "Executor broken. The server failed."
    # merging results
    xProcessPoolExecutor.shutdown(wait=True)
    xProcessPoolExecutor.shutdown(wait=True) # waiting that everything is finished
    dAllActions = {}
    sPyCallables = ""
    sJSCallables = ""
    for xFuture in lResult:
        sGraphName, dGraph, dActions, sPy, sJS = xFuture.result()
        #print(dGraph)
        #for k, v in dActions.items():
        #    print(k, ":", v)
        #input()
        dAllGraph[sGraphName] = dGraph
        dAllActions.update(dActions)
        sPyCallables += sPy
        sJSCallables += sJS
    print("  Total: ", nRule, "rules, ", len(dAllActions), "actions")
    print("  Build time: {:.2f} s".format(time.time() - fStartTimer))