maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH] Cosmetics for debug messages.


From: David Decotigny
Subject: [Maposmatic-dev] [PATCH] Cosmetics for debug messages.
Date: Sun, 29 Nov 2009 13:11:44 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)


Attached: a patch.

>From 1f93cdee600a7e13ee19da06efa88ef9bba97ff5 Mon Sep 17 00:00:00 2001
From: MapOSMatic developers <address@hidden>
Date: Sun, 29 Nov 2009 13:05:22 +0100
Subject: [PATCH] Cosmetics for debug messages.

Add a few debug messages as normal logging output instead of "print".
---
 scripts/maposmaticd |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/maposmaticd b/scripts/maposmaticd
index 299b42f..bb5c365 100755
--- a/scripts/maposmaticd
+++ b/scripts/maposmaticd
@@ -31,7 +31,7 @@ from ocitysmap.coords import BoundingBox as OCMBoundingBox
 from ocitysmap.street_index import OCitySMap 
 import Image
 
-def handler(signum, frame, pipe_write):
+def sigcld_handler(signum, frame, pipe_write):
     f = os.fdopen(pipe_write, 'w')
     f.write("end")
 
@@ -61,11 +61,10 @@ def render_job_process(job):
     return 0
 
 def render_job(job):
-    LOG.info("[job %d] starting rendering, title '%s'" % (job.id, 
job.maptitle))
+    LOG.info("[job %d] starting rendering, title '%s'" \
+                 % (job.id, job.maptitle))
     job.start_rendering()
     (pipe_read, pipe_write) = os.pipe()
-    signal.signal(signal.SIGCHLD,
-                  lambda signal, frame: handler(signal, frame, pipe_write))
     pid = os.fork()
     if pid == 0:
         # Son
@@ -88,6 +87,11 @@ def render_job(job):
 
     else:
         # Father
+        signal.signal(signal.SIGCHLD,
+                      lambda signal, frame: sigcld_handler(signal, frame,
+                                                           pipe_write))
+        LOG.debug("start of process %d" % pid)
+       # Don't close pipe_write here because the sigcld handler depends on it
         child_message = ""
         try:
             (rlist, wlist, xlist) = select.select([pipe_read], [], [], 20*60)
-- 
1.6.0.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]