From f565c1a157f9d67906532a590c80d02f5a7db73f Mon Sep 17 00:00:00 2001 From: Holger Nahrstaedt <holger@nahrstaedt.de> Date: Fri, 9 Mar 2018 18:14:35 +0100 Subject: [PATCH] fix flake8 Parallel processing improved --- beem/blockchain.py | 2 +- beemgrapheneapi/graphenerpc.py | 1 - examples/benchmark_beem.py | 30 +++++++++++++++--------------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/beem/blockchain.py b/beem/blockchain.py index 49101453..319a7860 100644 --- a/beem/blockchain.py +++ b/beem/blockchain.py @@ -180,7 +180,7 @@ class Blockchain(object): else: head_block = self.get_current_block_num() if threading and FUTURES_MODULE: - pool = ThreadPoolExecutor(2) + pool = ThreadPoolExecutor() latest_block = 0 for blocknum in range(start, head_block + 1, thread_num): futures = [] diff --git a/beemgrapheneapi/graphenerpc.py b/beemgrapheneapi/graphenerpc.py index bc31d0a4..d08a5e6f 100644 --- a/beemgrapheneapi/graphenerpc.py +++ b/beemgrapheneapi/graphenerpc.py @@ -217,7 +217,6 @@ class GrapheneRPC(object): except KeyboardInterrupt: raise except Exception as e: - print("error "+str(e)) log.critical("Error: {}n\n".format(str(e))) sleep_and_check_retries(self.num_retries, cnt, self.url) # retry diff --git a/examples/benchmark_beem.py b/examples/benchmark_beem.py index 84b63f9e..ff1726ea 100644 --- a/examples/benchmark_beem.py +++ b/examples/benchmark_beem.py @@ -17,33 +17,33 @@ logging.basicConfig(level=logging.INFO) if __name__ == "__main__": - node_setup = 2 + node_setup = 3 how_many_hours = 1 if node_setup == 0: stm = Steem(node="https://api.steemit.com", num_retries=10) - max_batch_size=None - threading=True - thread_num=8 + max_batch_size = None + threading = True + thread_num = 8 elif node_setup == 1: stm = Steem(node="https://api.steemitstage.com", num_retries=10) - max_batch_size=16 - threading=False - thread_num=8 + max_batch_size = None + threading = False + thread_num = 8 elif node_setup == 2: stm = Steem(node="https://api.steemitstage.com", num_retries=10) - max_batch_size=None - threading=True - thread_num=8 - elif node_setup == 3: + max_batch_size = None + threading = True + thread_num = 8 + elif node_setup == 3: stm = Steem(num_retries=10) - max_batch_size=None - threading=True - thread_num=8 + max_batch_size = None + threading = True + thread_num = 16 blockchain = Blockchain(steem_instance=stm) last_block_id = 19273700 last_block = Block(last_block_id, steem_instance=stm) startTime = datetime.now() - + stopTime = last_block.time() + timedelta(seconds=how_many_hours * 60 * 60) ltime = time.time() cnt = 0 -- GitLab