Skip to content
Snippets Groups Projects
Commit f565c1a1 authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

fix flake8

Parallel processing improved
parent f3d5cf05
No related branches found
No related tags found
No related merge requests found
...@@ -180,7 +180,7 @@ class Blockchain(object): ...@@ -180,7 +180,7 @@ class Blockchain(object):
else: else:
head_block = self.get_current_block_num() head_block = self.get_current_block_num()
if threading and FUTURES_MODULE: if threading and FUTURES_MODULE:
pool = ThreadPoolExecutor(2) pool = ThreadPoolExecutor()
latest_block = 0 latest_block = 0
for blocknum in range(start, head_block + 1, thread_num): for blocknum in range(start, head_block + 1, thread_num):
futures = [] futures = []
......
...@@ -217,7 +217,6 @@ class GrapheneRPC(object): ...@@ -217,7 +217,6 @@ class GrapheneRPC(object):
except KeyboardInterrupt: except KeyboardInterrupt:
raise raise
except Exception as e: except Exception as e:
print("error "+str(e))
log.critical("Error: {}n\n".format(str(e))) log.critical("Error: {}n\n".format(str(e)))
sleep_and_check_retries(self.num_retries, cnt, self.url) sleep_and_check_retries(self.num_retries, cnt, self.url)
# retry # retry
......
...@@ -17,33 +17,33 @@ logging.basicConfig(level=logging.INFO) ...@@ -17,33 +17,33 @@ logging.basicConfig(level=logging.INFO)
if __name__ == "__main__": if __name__ == "__main__":
node_setup = 2 node_setup = 3
how_many_hours = 1 how_many_hours = 1
if node_setup == 0: if node_setup == 0:
stm = Steem(node="https://api.steemit.com", num_retries=10) stm = Steem(node="https://api.steemit.com", num_retries=10)
max_batch_size=None max_batch_size = None
threading=True threading = True
thread_num=8 thread_num = 8
elif node_setup == 1: elif node_setup == 1:
stm = Steem(node="https://api.steemitstage.com", num_retries=10) stm = Steem(node="https://api.steemitstage.com", num_retries=10)
max_batch_size=16 max_batch_size = None
threading=False threading = False
thread_num=8 thread_num = 8
elif node_setup == 2: elif node_setup == 2:
stm = Steem(node="https://api.steemitstage.com", num_retries=10) stm = Steem(node="https://api.steemitstage.com", num_retries=10)
max_batch_size=None max_batch_size = None
threading=True threading = True
thread_num=8 thread_num = 8
elif node_setup == 3: elif node_setup == 3:
stm = Steem(num_retries=10) stm = Steem(num_retries=10)
max_batch_size=None max_batch_size = None
threading=True threading = True
thread_num=8 thread_num = 16
blockchain = Blockchain(steem_instance=stm) blockchain = Blockchain(steem_instance=stm)
last_block_id = 19273700 last_block_id = 19273700
last_block = Block(last_block_id, steem_instance=stm) last_block = Block(last_block_id, steem_instance=stm)
startTime = datetime.now() startTime = datetime.now()
stopTime = last_block.time() + timedelta(seconds=how_many_hours * 60 * 60) stopTime = last_block.time() + timedelta(seconds=how_many_hours * 60 * 60)
ltime = time.time() ltime = time.time()
cnt = 0 cnt = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment