add debug timestamp log for logs
Fixes: https://pagure.io/koji/issue/776
This commit is contained in:
parent
a3e281f7d1
commit
35b4d04561
1 changed files with 21 additions and 0 deletions
|
|
@ -381,6 +381,8 @@ class BuildRoot(object):
|
|||
uploadpath = self.getUploadPath()
|
||||
logs = {}
|
||||
|
||||
ts_file = None
|
||||
ts_state = {}
|
||||
finished = False
|
||||
while not finished:
|
||||
time.sleep(1)
|
||||
|
|
@ -388,6 +390,10 @@ class BuildRoot(object):
|
|||
if status[0] != 0:
|
||||
finished = True
|
||||
|
||||
if ts_file is None and os.path.exists(resultdir):
|
||||
ts_file = open(os.path.join(resultdir, 'ts.log'), 'wt')
|
||||
ts_file.write('filename,timestamp,offset\n')
|
||||
|
||||
try:
|
||||
results = os.listdir(resultdir)
|
||||
except OSError:
|
||||
|
|
@ -421,7 +427,22 @@ class BuildRoot(object):
|
|||
self.logger.error(''.join(traceback.format_exception(*sys.exc_info())))
|
||||
continue
|
||||
|
||||
if ts_file and fname != 'ts.log':
|
||||
# race condition against incremental_upload's tell,
|
||||
# but with enough precision for ts.log purposes
|
||||
position = fd.tell()
|
||||
ts_state.setdefault(fname, 0)
|
||||
if ts_state[fname] < position:
|
||||
ts_file.write('%s %f %i\n' % (fname, time.time(), position))
|
||||
ts_state[fname] = position
|
||||
incremental_upload(self.session, fname, fd, uploadpath, logger=self.logger)
|
||||
|
||||
# flush ts.log as it could be changed during previous iteration
|
||||
# but not uploaded.
|
||||
if ts_file:
|
||||
ts_file.close()
|
||||
incremental_upload(self.session, 'ts.log', logs['ts.log'][0], uploadpath, logger=self.logger)
|
||||
|
||||
#clean up and return exit status of command
|
||||
for (fname, (fd, inode, size, fpath)) in logs.items():
|
||||
if fd:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue