def run_load(args): logger.info('Starting %s processes', args.multiprocess) stats = logstats.Logstats() logstats.thread.start(stats) tx_left = None if args.count > 0: tx_left = int(args.count / args.multiprocess) workers = ProcessGroup(concurrency=args.multiprocess, target=_run_load, args=(tx_left, stats.get_child())) workers.start()
def run_load(args): bigchaindb.config_utils.autoconfigure(filename=args.config, force=True) logger.info('Starting %s processes', args.multiprocess) stats = logstats.Logstats() logstats.thread.start(stats) tx_left = None if args.count > 0: tx_left = int(args.count / args.multiprocess) workers = ProcessGroup(concurrency=args.multiprocess, target=_run_load, args=(tx_left, stats.get_child())) workers.start()
def test_process_group_instantiates_and_start_processes(mock_process): from bigchaindb.utils import ProcessGroup def noop(): pass concurrency = 10 pg = ProcessGroup(concurrency=concurrency, group='test_group', target=noop) pg.start() mock_process.assert_has_calls([call(group='test_group', target=noop, name=None, args=(), kwargs={}, daemon=None) for i in range(concurrency)], any_order=True) for process in pg.processes: process.start.assert_called_with()