def crawl(click_config, teacher_uri, registry_filepath, min_stake, network, learn_on_launch, provider_uri, influx_host, influx_port, dry_run): """ Gather NuCypher network information. """ # Banner emitter = click_config.emitter emitter.clear() emitter.banner(MONITOR_BANNER.format(CRAWLER)) registry = _get_registry(provider_uri, registry_filepath) # Teacher Ursula teacher_uris = [teacher_uri] if teacher_uri else None teacher_nodes = actions.load_seednodes( emitter, teacher_uris=teacher_uris, min_stake=min_stake, federated_only=False, network_domains={network} if network else None, network_middleware=click_config.middleware) # Configure Storage crawler = Crawler(domains={network} if network else None, network_middleware=RestMiddleware(), known_nodes=teacher_nodes, registry=registry, start_learning_now=True, learn_on_same_thread=learn_on_launch, blockchain_db_host=influx_host, blockchain_db_port=influx_port) if not dry_run: crawler.start() reactor.run()
def crawl( general_config, teacher_uri, registry_filepath, min_stake, network, learn_on_launch, provider_uri, influx_host, influx_port, http_port, dry_run, eager, poa, ): """ Gather NuCypher network information. """ # Banner emitter = general_config.emitter emitter.clear() emitter.banner(MONITOR_BANNER.format(CRAWLER)) # Setup BlockchainInterfaceFactory.initialize_interface(provider_uri=provider_uri, poa=poa) registry = _get_registry(registry_filepath, network) middleware = RestMiddleware() # Teacher Ursula sage_node = None if teacher_uri: sage_node = Ursula.from_teacher_uri( teacher_uri=teacher_uri, min_stake=0, # TODO: Where to get this? federated_only=False, # always False network_middleware=middleware, registry=registry) crawler = Crawler(domain=network if network else None, network_middleware=middleware, known_nodes=[sage_node] if teacher_uri else None, registry=registry, start_learning_now=eager, learn_on_same_thread=learn_on_launch, influx_host=influx_host, influx_port=influx_port) emitter.message(f"Network: {network.capitalize()}", color='blue') emitter.message(f"InfluxDB: {influx_host}:{influx_port}", color='blue') emitter.message(f"Provider: {provider_uri}", color='blue') emitter.message(f"Refresh Rate: {crawler._refresh_rate}s", color='blue') message = f"Running Nucypher Crawler JSON endpoint at http://localhost:{http_port}/stats" emitter.message(message, color='green', bold=True) if not dry_run: crawler.start(eager=eager) reactor.run()
def create_crawler(node_db_filepath: str = IN_MEMORY_FILEPATH, dont_set_teacher: bool = False): registry = InMemoryContractRegistry() middleware = RestMiddleware() teacher_nodes = None if not dont_set_teacher: teacher_nodes = actions.load_seednodes( None, # TODO: Needs emitter teacher_uris=[DEFAULT_TEACHER], # TODO: Needs Cleanup min_stake=0, federated_only=False, network_domains={'gemini'}, # TODO: Needs Cleanup network_middleware=middleware) crawler = Crawler( domains={'goerli'}, # TODO: Needs Cleanup network_middleware=middleware, known_nodes=teacher_nodes, registry=registry, start_learning_now=True, learn_on_same_thread=False, influx_host='localhost', # TODO: Needs Cleanup influx_port=8086, # TODO: Needs Cleanup node_storage_filepath=node_db_filepath) return crawler
def create_crawler(node_db_filepath: str = IN_MEMORY_FILEPATH): registry = InMemoryContractRegistry() middleware = RestMiddleware() crawler = Crawler(domain='ibex', # TODO: Needs Cleanup network_middleware=middleware, registry=registry, start_learning_now=True, learn_on_same_thread=False, influx_host='localhost', # TODO: Needs Cleanup influx_port=8086, # TODO: Needs Cleanup node_storage_filepath=node_db_filepath ) return crawler
def create_crawler(node_db_filepath: str = IN_MEMORY_FILEPATH, dont_set_teacher: bool = False): registry = InMemoryContractRegistry() middleware = RestMiddleware() teacher_nodes = None if not dont_set_teacher: teacher_nodes = actions.load_seednodes( None, teacher_uris=['https://discover.nucypher.network:9151'], min_stake=0, federated_only=False, network_domains={'goerli'}, network_middleware=middleware) crawler = Crawler(domains={'goerli'}, network_middleware=middleware, known_nodes=teacher_nodes, registry=registry, start_learning_now=True, learn_on_same_thread=False, blockchain_db_host='localhost', blockchain_db_port=8086, node_storage_filepath=node_db_filepath) return crawler