|
@@ -52,13 +52,16 @@ class Worker(object):
|
52
|
52
|
def work(self, *args, **kwargs):
|
53
|
53
|
seed_value = kwargs.pop('seed')
|
54
|
54
|
random.seed(seed_value)
|
55
|
|
- while True:
|
56
|
|
- args = self.process_read_pipe.recv()
|
57
|
|
- if args == STOP:
|
58
|
|
- return
|
59
|
|
-
|
60
|
|
- result = self.real_job(*args)
|
61
|
|
- self.local_write_pipe.send(result)
|
|
55
|
+ try:
|
|
56
|
+ while True:
|
|
57
|
+ args = self.process_read_pipe.recv()
|
|
58
|
+ if args == STOP:
|
|
59
|
+ return
|
|
60
|
+
|
|
61
|
+ result = self.real_job(*args)
|
|
62
|
+ self.local_write_pipe.send(result)
|
|
63
|
+ except KeyboardInterrupt:
|
|
64
|
+ return
|
62
|
65
|
|
63
|
66
|
|
64
|
67
|
class ProcessManager(BaseObject):
|