[copr] skvidal-backend: logs should go to a better place now (1412938)

skvidal at fedorahosted.org skvidal at fedorahosted.org
Fri Nov 16 19:43:49 UTC 2012


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

On branch  : skvidal-backend

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

commit 1412938b5e9411c72ab41f5563e0e493b6e6867c
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Nov 16 14:41:26 2012 -0500

    logs should go to a better place now


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

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

diff --git a/backend/dispatcher.py b/backend/dispatcher.py
index 3c0e160..0fc1ada 100644
--- a/backend/dispatcher.py
+++ b/backend/dispatcher.py
@@ -81,7 +81,7 @@ class WorkerCallback(object):
             
         
 class Worker(multiprocessing.Process):
-    def __init__(self, opts, jobs, ip=None, create=True, callback=None):
+    def __init__(self, opts, jobs, worker_num, ip=None, create=True, callback=None):
  
         # base class initialization
         multiprocessing.Process.__init__(self, name="worker-builder")
@@ -89,12 +89,13 @@ class Worker(multiprocessing.Process):
             
         # job management stuff
         self.jobs = jobs
+        self.worker_num = worker_num
         self.ip = ip
         self.opts = opts
         self.kill_received = False
         self.callback = callback
         if not self.callback:
-            lf = self.opts.worker_logdir + '/worker-%s.log'  % self.pid
+            lf = self.opts.worker_logdir + '/worker-%s.log' % self.worker_num
             self.callback = WorkerCallback(logfile = lf)
         
         self.callback.log('creating worker: %s' % ip)
@@ -188,6 +189,8 @@ class Worker(multiprocessing.Process):
             job.ended_on = time.time()
             job.status = status
             self.return_results(job)
+            self.callback.log('worker finished build: %s' % ip)
+            # call terminate on the instance
             
             
             
diff --git a/copr-be.py b/copr-be.py
index da97128..7e9e3c4 100644
--- a/copr-be.py
+++ b/copr-be.py
@@ -99,7 +99,8 @@ class CoprBackend(object):
                 # this handles starting/growing the number of workers
                 if len(self.workers) < self.opts.num_workers:
                     for i in range(self.opts.num_workers - len(self.workers)):
-                        w = Worker(self.opts, self.jobs)
+                        worker_num = len(self.workers) + 1
+                        w = Worker(self.opts, self.jobs, worker_num)
                         self.workers.append(w)
                         w.start()
                 # FIXME - prune out workers



More information about the copr-devel mailing list