concurrent popper on the same thread, inspired by rpgoldman - #148
Open
DARKMOONlite wants to merge 3 commits into
Open
concurrent popper on the same thread, inspired by rpgoldman#148DARKMOONlite wants to merge 3 commits into
DARKMOONlite wants to merge 3 commits into
Conversation
…er/tester.py by loading the files into modules to keep them more seperate than before, allowing a system to run them concurrently in a single python instance this allows the system to be run with a ThreadPoolExecutor or a ProcessPoolExecutor without needing to specify max_tasks_per_child=1. The only diversion from @rpgoldman's code was using a uuid rather than the current time to create unique names for the tempory prolog module, and the test.pl file is converted to a temporary file before being loaded into the prolog module to get around an issue with prolog where a single file cannot be loaded by multiple modules, im not sure how @rpgoldman's code got around this limiation.
…am unsure if the temporary module is still being deleted but it will be cleaned up when the prolog instance is deleted tho so as long as someone doesn't do hundreds of incredibly large experiments they'll be fine.
…s into the tester class which means we do not need to pass the module around
Collaborator
|
I revised the code a little to make it a bit simpler. I did not know how to edit this PR (or even if it is possible) so I made a new branch: https://github.com/logic-and-learning-lab/Popper/tree/fix/tester-module-consult I think it works as you expect. Can you check? |
Author
|
sorry, had some pressing home matters to address. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue:
running popper in the same process doesn't work due to conflict between the popper instances. to run even using a
ProcessPoolThreadrequires themax_tasks_per_childparameter set to1which caused some issues with running Popper for me. since then I've been using @rpgoldman's branch to get around this issue, but this branch is out of date, and is missing out on a lot of modern improvements to popper since the big refactoring.e.g.
Fix
Testerclass is created it creates a unique uuid to create a unique and identifiable popper module.janusfunctions are then wrapped in thequery_oncefunction which loads all relevant facts into that specific module name (the original method is loaded as janus_query_once) this is done to reduce coding footprint, other naming conventions are usable idk.Result:
the system can now run multiple threads using a
ThreadPoolExecutorwithout background bleed.@andrewcropper what do you think?