Created
September 6, 2020 12:11
-
-
Save Iftimie/7dd68e3beb9c715323defff78b4a5b40 to your computer and use it in GitHub Desktop.
This file contains 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
def on_post(self, req, resp): | |
phrase_file = req.params['phrase_file'] | |
... | |
trie_local_file_name = f"/app/assembler/triebuilder/shared_data/trie_{phrase_file}.dat" | |
pickle.dump(trie, open(trie_local_file_name, "wb")) | |
... | |
This file contains 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
def _load_trie(self): | |
shared_path = "/app/distributor/backend/shared_data" | |
trie_files = sorted(os.listdir(shared_path)) | |
if trie_files and trie_files[-1]!=self.trie_file: | |
self.trie = pickle.load( open(os.path.join(shared_path, trie_files[-1]), "rb")) | |
self.trie_file = trie_files[-1] | |
else: | |
self.trie = Trie() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment