From d46eaae7a3afc424d03475354c12c3d83aa476ff Mon Sep 17 00:00:00 2001 From: MoonGem <34537029+MoonGem@users.noreply.github.com> Date: Fri, 23 Mar 2018 18:44:37 -0500 Subject: [PATCH] Update start-hyperopt-worker.py --- scripts/start-hyperopt-worker.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/start-hyperopt-worker.py b/scripts/start-hyperopt-worker.py index db80ec8de..8b0ae6326 100755 --- a/scripts/start-hyperopt-worker.py +++ b/scripts/start-hyperopt-worker.py @@ -2,8 +2,7 @@ import multiprocessing import os import subprocess -import sys -import shlex + PROC_COUNT = multiprocessing.cpu_count() - 1 DB_NAME = 'freqtrade_hyperopt' WORK_DIR = os.path.join( @@ -20,9 +19,9 @@ command = [ '--mongo=127.0.0.1:1234/{}'.format(DB_NAME), '--poll-interval=0.1', '--workdir={}'.format(WORK_DIR), - '--max-jobs=100000', - '--max-consecutive-failures=100000', ] -def run(command): - subprocess.call(command, shell=True)) -run(command) +processes = [subprocess.Popen(command) for i in range(PROC_COUNT)] + +# Join all workers +for proc in processes: + proc.wait()