[copr] master: make the event log have a bit more detail and be simpler to follow (c74ba30)
skvidal at fedorahosted.org
skvidal at fedorahosted.org
Tue Jan 15 17:27:50 UTC 2013
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit c74ba308810fc05666fca8444446e24ec1a6e312
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Tue Jan 15 12:27:23 2013 -0500
make the event log have a bit more detail and be simpler to follow
>---------------------------------------------------------------
backend/dispatcher.py | 11 +++++++----
copr-be.py | 4 ++--
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/backend/dispatcher.py b/backend/dispatcher.py
index 1485285..6762ac5 100644
--- a/backend/dispatcher.py
+++ b/backend/dispatcher.py
@@ -178,6 +178,8 @@ class Worker(multiprocessing.Process):
jobdata.repos.append(jobdata.results)
jobdata.copr_id = build['copr']['id']
jobdata.user_id = build['user_id']
+ jobdata.user_name = build['copr']['owner']['name']
+ jobdata.copr_name = build['copr']['name']
return jobdata
# maybe we move this to the callback?
@@ -206,7 +208,7 @@ class Worker(multiprocessing.Process):
# maybe we move this to the callback?
def mark_started(self, job):
- self.event('job start: user:%s copr:%s build:%s ip:%s pid:%s' % (job.user_id, job.copr_id, job.build_id, self.ip, self.pid))
+
build = {'id':job.build_id,
'started_on': job.started_on,
'results': job.results,
@@ -218,7 +220,6 @@ class Worker(multiprocessing.Process):
# maybe we move this to the callback?
def return_results(self, job):
- self.event('job end: user:%s copr:%s build:%s ip:%s pid:%s' % (job.user_id, job.copr_id, job.build_id, self.ip, self.pid))
self.callback.log('%s status %s. Took %s seconds' % (job.build_id, job.status, job.ended_on - job.started_on))
build = {'id':job.build_id,
@@ -269,8 +270,10 @@ class Worker(multiprocessing.Process):
job.started_on = time.time()
self.mark_started(job)
- for chroot in job.chroots:
+ self.event('job start: user:%s copr:%s build:%s ip:%s pid:%s' % (job.user_name, job.copr_name, job.build_id, ip, self.pid))
+ for chroot in job.chroots:
+ self.event('job chroot start: chroot:%s user:%s copr:%s build:%s ip:%s pid:%s' % (chroot, job.user_name, job.copr_name, job.build_id, ip, self.pid))
chroot_destdir = job.destdir + '/' + chroot
# setup our target dir locally
if not os.path.exists(chroot_destdir):
@@ -309,12 +312,12 @@ class Worker(multiprocessing.Process):
if mr.failed:
status = 0
self.callback.log('Finished build: id=%r builder=%r timeout=%r destdir=%r chroot=%r repos=%r' % (job.build_id, ip, job.timeout, job.destdir, chroot, str(job.repos)))
-
job.ended_on = time.time()
job.status = status
self.return_results(job)
self.callback.log('worker finished build: %s' % ip)
+ self.event('job end: user:%s copr:%s build:%s ip:%s pid:%s' % (job.user_name, job.copr_name, job.build_id, ip, self.pid))
# clean up the instance
if self.create:
self.terminate_instance(ip)
diff --git a/copr-be.py b/copr-be.py
index 78256a7..e76e54f 100644
--- a/copr-be.py
+++ b/copr-be.py
@@ -35,7 +35,7 @@ class CoprJobGrab(multiprocessing.Process):
self.added_jobs = []
def event(self, what):
- self.events.put({'when':time.time(), 'who':'job', 'what':what})
+ self.events.put({'when':time.time(), 'who':'jobgrab', 'what':what})
def fetch_jobs(self):
self.event('fetching jobs')
@@ -99,7 +99,7 @@ class CoprLog(multiprocessing.Process):
def log(self, event):
when = time.strftime('%F %T', time.gmtime(event['when']))
- msg = '%s : %s %s' % (when, event['who'], event['what'].strip())
+ msg = '%s : %s: %s' % (when, event['who'], event['what'].strip())
try:
open(self.logfile, 'a').write(msg + '\n')
More information about the copr-devel
mailing list