Start a number of nodes in parallel, each with its own options
(self, num_nodes, opts=None)
| 1422 | return node_id |
| 1423 | |
| 1424 | def get_nodes(self, num_nodes, opts=None): |
| 1425 | """Start a number of nodes in parallel, each with its own options |
| 1426 | """ |
| 1427 | if opts is None: |
| 1428 | # No opts were passed in, give some dummy opts |
| 1429 | opts = [{} for _ in range(num_nodes)] |
| 1430 | elif isinstance(opts, dict): |
| 1431 | # A single dict was passed in, so we use these opts for all nodes |
| 1432 | opts = [opts] * num_nodes |
| 1433 | |
| 1434 | assert len(opts) == num_nodes |
| 1435 | |
| 1436 | # Only trace one random node's plugins, to avoid OOM. |
| 1437 | if SLOW_MACHINE: |
| 1438 | valgrind_plugins = [False] * num_nodes |
| 1439 | valgrind_plugins[random.randint(0, num_nodes - 1)] = True |
| 1440 | else: |
| 1441 | valgrind_plugins = [True] * num_nodes |
| 1442 | |
| 1443 | jobs = [] |
| 1444 | for i in range(num_nodes): |
| 1445 | node_opts, cli_opts = self.split_options(opts[i]) |
| 1446 | jobs.append(self.executor.submit( |
| 1447 | self.get_node, options=cli_opts, |
| 1448 | node_id=self.get_node_id(), **node_opts, |
| 1449 | valgrind_plugins=valgrind_plugins[i] |
| 1450 | )) |
| 1451 | |
| 1452 | return [j.result() for j in jobs] |
| 1453 | |
| 1454 | def get_node(self, node_id=None, options=None, dbfile=None, |
| 1455 | bkpr_dbfile=None, feerates=(15000, 11000, 7500, 3750), |