summaryrefslogtreecommitdiffstats
path: root/wallace
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-12 12:22:44 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-12 12:22:44 +0100
commit6c6a868467b36d5b5d5dfbc1f3882131e11d2558 (patch)
tree4f8e643874435c3762193708cbb49b7c772fd528 /wallace
parente679b768f55589ab30817a17dcdb7e88be23f85a (diff)
downloadpykolab-6c6a868467b36d5b5d5dfbc1f3882131e11d2558.tar.gz
Provide Python 2.6 compatibility in multiprocessing.Pool class arguments
Execute do_wallace() only the one time
Diffstat (limited to 'wallace')
-rw-r--r--wallace/__init__.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/wallace/__init__.py b/wallace/__init__.py
index 0e8a4f7..55a6d26 100644
--- a/wallace/__init__.py
+++ b/wallace/__init__.py
@@ -133,7 +133,10 @@ class WallaceDaemon(object):
self.modules.append('resources')
def do_wallace(self):
- self.pool = multiprocessing.Pool(max_threads, worker_process, (), 1)
+ if version.StrictVersion(sys.version[:3]) >= version.StrictVersion("2.7"):
+ self.pool = multiprocessing.Pool(max_threads, worker_process, (), 1)
+ else:
+ self.pool = multiprocessing.Pool(max_threads, worker_process, ())
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@@ -335,16 +338,17 @@ class WallaceDaemon(object):
try:
pid = 1
+
if conf.fork_mode:
- self.thread_count += 1
- self.write_pid()
- self.set_signal_handlers()
pid = os.fork()
if pid == 0:
log.remove_stdout_handler()
-
- self.do_wallace()
+ self.write_pid()
+ self.set_signal_handlers()
+ self.do_wallace()
+ elif not conf.fork_mode:
+ self.do_wallace()
except SystemExit, e:
exitcode = e