diff --git a/timmy/nodes.py b/timmy/nodes.py index 970e497..91049c7 100644 --- a/timmy/nodes.py +++ b/timmy/nodes.py @@ -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 diff --git a/timmy/tools.py b/timmy/tools.py index 451202b..a8655c3 100644 --- a/timmy/tools.py +++ b/timmy/tools.py @@ -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: