Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Switched from threads to process
Browse files Browse the repository at this point in the history
  • Loading branch information
rtrevinnoc committed Feb 25, 2021
1 parent 6cf7173 commit 01d9bb0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions future.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#########################################################################

from Monad import *
import os.path, os, shutil, json, random, sys, socket, re, mimetypes, datetime, lmdb, hnswlib, time, bson, requests, socket, ast, functools, asyncio, concurrent.futures, itertools, mimetypes, io, threading, languagecodes
import os.path, os, shutil, json, random, sys, socket, re, mimetypes, datetime, lmdb, hnswlib, time, bson, requests, socket, ast, functools, asyncio, concurrent.futures, itertools, mimetypes, io, multiprocessing, languagecode
import numpy as np
import numexpr as ne
from flask import (Flask, render_template, request, redirect,
Expand Down Expand Up @@ -318,11 +318,11 @@ def loadMoreUrls(q_vec: np.ndarray, queryLanguage: str, numberOfURLs: int,
"language": url["language"],
} for url in search["results"]]

minter_thread = threading.Thread(target=mintTokens,
args=(q_vec,
np.frombuffer(
search["results"][0]["vec"],
dtype=np.float32)))
minter_thread = multiprocessing.Process(
target=mintTokens,
args=(q_vec,
np.frombuffer(search["results"][0]["vec"],
dtype=np.float32)))
minter_thread.start()

urlsInPreferedLanguage, urlsInOtherLanguages = [], []
Expand Down Expand Up @@ -360,7 +360,7 @@ def loadMoreImages(term: np.ndarray, number, page: int) -> dict:
image = bson.loads(
imageDBTransaction.get(str(image).encode("utf-8")))
if idx == 1:
minter_thread = threading.Thread(
minter_thread = multiprocessing.Process(
target=mintTokens,
args=(term,
np.frombuffer(image["vec"], dtype=np.float32)))
Expand Down

0 comments on commit 01d9bb0

Please sign in to comment.