Move slowpipe to tools and make it cleaner
This commit is contained in:
parent
e4d8341c9a
commit
8d3b04666f
@ -640,15 +640,7 @@ class Nodes(object):
|
||||
speed = int(speed * 0.9 / maxthreads)
|
||||
else:
|
||||
speed = int(speed * 0.9 / len(self.nodes))
|
||||
pythonslowpipe = 'import sys\n'
|
||||
pythonslowpipe += 'import time\n'
|
||||
pythonslowpipe += 'while 1:\n'
|
||||
pythonslowpipe += ' a = sys.stdin.read(int(1250*%s))\n' % speed
|
||||
pythonslowpipe += ' if a:\n'
|
||||
pythonslowpipe += ' sys.stdout.write(a)\n'
|
||||
pythonslowpipe += ' time.sleep(0.01)\n'
|
||||
pythonslowpipe += ' else:\n'
|
||||
pythonslowpipe += ' break\n'
|
||||
pythonslowpipe = slowpipe % speed
|
||||
semaphore = multiprocessing.BoundedSemaphore(maxthreads)
|
||||
for node in self.nodes.values():
|
||||
if (self.cluster and str(self.cluster) != str(node.cluster) and
|
||||
|
@ -27,6 +27,19 @@ import multiprocessing
|
||||
import subprocess
|
||||
|
||||
|
||||
slowpipe = '''
|
||||
import sys
|
||||
import time
|
||||
while 1:
|
||||
a = sys.stdin.read(int(1250*%s))
|
||||
if a:
|
||||
sys.stdout.write(a)
|
||||
time.sleep(0.01)
|
||||
else:
|
||||
break
|
||||
'''
|
||||
|
||||
|
||||
def interrupt_wrapper(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user