def start(self): """ Initialize, spawn, and start the processes """ # initialize the processes p_write = ProcessGroup(name='write_blocks', target=self.write_blocks) # start the processes p_write.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 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.util 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()
def _start(self): """ Initialize, spawn, and start the processes """ # initialize the processes p_filter = ProcessGroup(name='filter_transactions', target=self.filter_by_assignee) p_validate = ProcessGroup(name='validate_transactions', target=self.validate_transactions) p_blocks = ProcessGroup(name='create_blocks', target=self.create_blocks) p_write = ProcessGroup(name='write_blocks', target=self.write_blocks) p_delete = ProcessGroup(name='delete_transactions', target=self.delete_transactions) # start the processes p_filter.start() p_validate.start() p_blocks.start() p_write.start() p_delete.start()
def run_add_backlog(args): tx_left = args.num_transactions // mp.cpu_count() workers = ProcessGroup(target=create_write_transaction, args=(tx_left,)) workers.start()