[copr] skvidal-backend: - check daemonize before daemonizing - output time in a more human readable format (4f0bd84)

skvidal at fedorahosted.org skvidal at fedorahosted.org
Wed Dec 5 19:33:49 UTC 2012


Repository : http://git.fedorahosted.org/cgit/copr.git

On branch  : skvidal-backend

>---------------------------------------------------------------

commit 4f0bd842fd295465eefb1037f7458ff9b620faae
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Wed Dec 5 14:31:38 2012 -0500

    - check daemonize before daemonizing
    - output time in a more human readable format


>---------------------------------------------------------------

 backend/dispatcher.py |    2 +-
 copr-be.py            |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/backend/dispatcher.py b/backend/dispatcher.py
index e1a47dc..434e671 100644
--- a/backend/dispatcher.py
+++ b/backend/dispatcher.py
@@ -74,7 +74,7 @@ class WorkerCallback(object):
         if not self.logfile:
             return
             
-        now = time.time()
+        now = time.strftime('%F %T')
         try:
             open(self.logfile, 'a').write(str(now) + ':' + msg + '\n')
         except (IOError, OSError), e:
diff --git a/copr-be.py b/copr-be.py
index fc03430..a3e372a 100644
--- a/copr-be.py
+++ b/copr-be.py
@@ -82,7 +82,7 @@ class CoprBackend(object):
         
         
     def log(self, msg):
-        now = time.time()
+        now =  time.strftime('%F %T')
         output = str(now) + ':' + msg
         if not self.opts.daemonize:
             print output
@@ -199,7 +199,8 @@ def main(args):
         cbe = CoprBackend(opts.config_file)
         cbe.opts.daemonize = opts.daemonize # just so we have it on hand
         cbe.opts.exit_on_worker = opts.exit_on_worker
-        daemonize(opts.pidfile)
+        if opts.daemonize:
+            daemonize(opts.pidfile)
         cbe.run()
     except Exception, e:
         print 'Killing/Dying'



More information about the copr-devel mailing list