From b63db679c1f07c6f07aef0733e1863097e6c5794 Mon Sep 17 00:00:00 2001 From: MoonGem <34537029+MoonGem@users.noreply.github.com> Date: Sun, 25 Mar 2018 09:32:05 -0500 Subject: [PATCH] Code clean-up --- user_data/random/random.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/user_data/random/random.py b/user_data/random/random.py index 5df05414f..f2f474043 100644 --- a/user_data/random/random.py +++ b/user_data/random/random.py @@ -1,14 +1,11 @@ #!/usr/bin/env python3 import os import multiprocessing -from itertools import zip_longest import subprocess import re PROC_COUNT = multiprocessing.cpu_count() - 1 cwd = os.getcwd() print(cwd) -global procs -limit = 24 WORK_DIR = os.path.join( os.path.sep, os.path.abspath(os.path.dirname(__file__)), @@ -22,12 +19,13 @@ command = [ 'backtesting', ] global current +global procs current = 0 procs = 0 DEVNULL = open(os.devnull, 'wb') while True: - while procs < 32: + while procs < PROC_COUNT: try: procs + 1 proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)