async def do_run(self, event_bus: EndpointAPI) -> None: if self._boot_info.args.enable_metrics: metrics_service = metrics_service_from_args(self._boot_info.args) else: metrics_service = NOOP_METRICS_SERVICE proxy_peer_pool = ETHProxyPeerPool(event_bus, TO_NETWORKING_BROADCAST_CONFIG) async with background_trio_service(proxy_peer_pool): async with background_trio_service(metrics_service): service = NewBlockService( event_bus, proxy_peer_pool, metrics_service.registry, self._boot_info) async with background_trio_service(service) as manager: await manager.wait_finished()
async def do_run(cls, boot_info: BootInfo, event_bus: EndpointAPI) -> None: if boot_info.args.enable_metrics: metrics_service = metrics_service_from_args( boot_info.args, AsyncioMetricsService) else: # Use a NoopMetricsService so that no code branches need to be taken if metrics # are disabled metrics_service = NOOP_METRICS_SERVICE trinity_config = boot_info.trinity_config NodeClass = trinity_config.get_app_config(Eth1AppConfig).node_class node = NodeClass(event_bus, metrics_service, trinity_config) strategy = cls.get_active_strategy(boot_info) async with background_asyncio_service(node) as manager: await cls.launch_sync(node, strategy, boot_info, event_bus) await manager.wait_finished()
async def do_run(self, event_bus: EndpointAPI) -> None: boot_info = self._boot_info if boot_info.args.enable_metrics: metrics_service = metrics_service_from_args(boot_info.args, AsyncioMetricsService) else: # Use a NoopMetricsService so that no code branches need to be taken if metrics # are disabled metrics_service = NOOP_METRICS_SERVICE trinity_config = boot_info.trinity_config NodeClass = trinity_config.get_app_config(Eth1AppConfig).node_class node = NodeClass(event_bus, metrics_service, trinity_config) strategy = self.get_active_strategy(boot_info) async with background_asyncio_service(node) as node_manager: sync_task = asyncio.create_task(self.launch_sync(node, strategy, boot_info, event_bus)) # The Node service is our responsibility, so we must exit if either that or the syncer # returns. await wait_first([sync_task, asyncio.create_task(node_manager.wait_finished())])