#!/usr/bin/env python3 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( os.path.sep, os.path.abspath(os.path.dirname(__file__)), '..', '.hyperopt', 'worker' ) if not os.path.exists(WORK_DIR): os.makedirs(WORK_DIR) # Spawn workers command = [ 'hyperopt-mongo-worker', '--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)