Better processing time, cut down on processing time.

This commit is contained in:
MoonGem 2018-03-25 09:30:27 -05:00 committed by GitHub
parent 8c2c3983b7
commit 77ea47f32b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,9 +7,8 @@ import re
PROC_COUNT = multiprocessing.cpu_count() - 1 PROC_COUNT = multiprocessing.cpu_count() - 1
cwd = os.getcwd() cwd = os.getcwd()
print(cwd) print(cwd)
global procs
limit = 24
limit = multiprocessing.cpu_count() - 1
WORK_DIR = os.path.join( WORK_DIR = os.path.join(
os.path.sep, os.path.sep,
os.path.abspath(os.path.dirname(__file__)), os.path.abspath(os.path.dirname(__file__)),
@ -24,14 +23,14 @@ command = [
] ]
global current global current
current = 0 current = 0
procs = 0
DEVNULL = open(os.devnull, 'wb') DEVNULL = open(os.devnull, 'wb')
while True: while True:
def Run(command): while procs < 32:
global current try:
processes = [subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) for i in range(PROC_COUNT)] procs + 1
for proc in processes: proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
wait = proc.communicate() wait = proc.communicate()
string = str(wait) string = str(wait)
params = re.search(r'~~~~(.*)~~~~', string).group(1) params = re.search(r'~~~~(.*)~~~~', string).group(1)
@ -62,4 +61,6 @@ while True:
if rsi: if rsi:
print('~~~RSI~~~') print('~~~RSI~~~')
print(rsi.group(1)) print(rsi.group(1))
data = Run(command) procs - 1
except Exception as e:
print(e)