Commit d55aee9b authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

Cosmetic change: dropped the machine column

parent adf75232
......@@ -126,7 +126,7 @@ if eflag and not maxNbErrors:
maxNbErrors = 10
_repackRequestStatuses = ['STARTING', 'ONGOING', 'FINISHED', 'FAILED', 'ABORTING', 'ABORTED', 'SUBMITTED']
def _printStatusLine(subTime, lastModTime, user, machine, vid, status, total, size, toRecall, toMigr, failed, migrated):
def _printStatusLine(subTime, lastModTime, user, vid, status, total, size, toRecall, toMigr, failed, migrated):
'''prints one status line'''
# dealing with global status
status = _repackRequestStatuses[status]
......@@ -149,30 +149,30 @@ def _printStatusLine(subTime, lastModTime, user, machine, vid, status, total, si
if total > 0 and status != 'STARTING':
# Completion % takes into account each operation (recall and migration) as 1, so that e.g. a tape with half files recalled and none migrated counts as 25% done;
# no weight is given to recalls vs. migrations nor is the file size taken into account.
print '%-18s%13s%17s%29s%9s%11d%12s%10d%10d%10d%10d%7d%%%11s' % (subTime, repackTime, user, machine, vid, total, size, toRecall, toMigr, failed, migrated, 100-(2*toRecall+toMigr)*50.0/total, status)
print '%-18s%13s%17s%9s%11d%12s%10d%10d%10d%10d%7d%%%11s' % (subTime, repackTime, user, vid, total, size, toRecall, toMigr, failed, migrated, 100-(2*toRecall+toMigr)*50.0/total, status)
else:
print '%-18s%13s%17s%29s%9s%11d%12s%10d%10d%10d%10d N/A %11s' % (subTime, repackTime, user, machine, vid, total, size, toRecall, toMigr, failed, migrated, status)
print '%-18s%13s%17s%9s%11d%12s%10d%10d%10d%10d N/A %11s' % (subTime, repackTime, user, vid, total, size, toRecall, toMigr, failed, migrated, status)
except TypeError:
# case of reporting without details
print '%-18s%13s%17s%29s%9s%11d%12s%11s' % (subTime, repackTime, user, machine, vid, total, size, status)
print '%-18s%13s%17s%9s%11d%12s%11s' % (subTime, repackTime, user, vid, total, size, status)
def _displaySummary(rows):
'''prints a summary of all repack requests according to the given criteria'''
# print out results
print '='*120
print 'SubmitTime RepackTime User Machine Vid Total Size Status'
print '-'*120
print '='*91
print 'SubmitTime RepackTime User Vid Total Size Status'
print '-'*91
sumTotal = sumSize = 0
globalStatus = 2 # FINISHED
shownVids = set()
count = 0
for subTime, lastModTime, user, machine, vid, status, total, totsize in rows:
for subTime, lastModTime, user, vid, status, total, totsize in rows:
if not vids and vid in shownVids:
# when showing full statistics skip the less recent requests for each VID
continue
shownVids.add(vid)
_printStatusLine(subTime, lastModTime, user, machine, vid, status, total, totsize, '-', '-', '-', '-')
_printStatusLine(subTime, lastModTime, user, vid, status, total, totsize, '-', '-', '-', '-')
sumTotal += total
count += 1
if totsize > 0:
......@@ -182,28 +182,28 @@ def _displaySummary(rows):
globalStatus = 0 # STARTING
if (status == 1 or status == 4) and globalStatus == 2:
globalStatus = 1 # ONGOING
print '-'*120
print '-'*91
# when showing full statistics, print out summary line
if not vids and sumTotal > 0:
_printStatusLine(time.time(), 0, '-', 'TOTAL', count, globalStatus, sumTotal, sumSize, '-', '-', '-', '-')
_printStatusLine(time.time(), 0, 'TOTAL', count, globalStatus, sumTotal, sumSize, '-', '-', '-', '-')
def _displayDetailed(rows):
'''prints the details of all repack requests according to the given criteria'''
# print out results
print '='*168
print 'SubmitTime RepackTime User Machine Vid Total Size toRecall toMigr Failed Migrated Compl% Status'
print '-'*168
print '='*139
print 'SubmitTime RepackTime User Vid Total Size toRecall toMigr Failed Migrated Compl% Status'
print '-'*139
sumTotal = sumSize = sumToRecall = sumToMigr = sumFailed = sumMigrated = 0
globalStatus = 2 # FINISHED
shownVids = set()
count = 0
for subTime, lastModTime, user, machine, vid, status, total, totsize, toRecall, toMigr, failed in rows:
for subTime, lastModTime, user, vid, status, total, totsize, toRecall, toMigr, failed in rows:
if not vids and vid in shownVids:
# when showing full statistics skip the less recent requests for each VID
continue
shownVids.add(vid)
migrated = total - toRecall - toMigr - failed
_printStatusLine(subTime, lastModTime, user, machine, vid, status, total, totsize, toRecall, toMigr, failed, migrated)
_printStatusLine(subTime, lastModTime, user, vid, status, total, totsize, toRecall, toMigr, failed, migrated)
sumTotal += total
if totsize > 0:
# it may have returned None
......@@ -217,10 +217,10 @@ def _displayDetailed(rows):
globalStatus = 0 # STARTING
if (status == 1 or status == 4) and globalStatus == 2:
globalStatus = 1 # ONGOING
print '-'*168
print '-'*139
# when showing full statistics, print out summary line
if not vids and sumTotal > 0:
_printStatusLine(time.time(), 0, '-', 'TOTAL', count, globalStatus, sumTotal, sumSize, sumToRecall, sumToMigr, sumFailed, sumMigrated)
_printStatusLine(time.time(), 0, 'TOTAL', count, globalStatus, sumTotal, sumSize, sumToRecall, sumToMigr, sumFailed, sumMigrated)
def displayStatus(detailed):
'''displays the ongoing repacks. If vids is not empty, the output is limited to these tapes'''
......@@ -231,7 +231,7 @@ def displayStatus(detailed):
if not detailed:
stGetStatus = '''
SELECT creationTime, lastModificationTime, username,
machine, repackVID, status, fileCount total, totalSize totsize
repackVID, status, fileCount total, totalSize totsize
FROM StageRepackRequest
'''
# query only the requested VIDs. This requires hard parsing but it's still more efficient
......@@ -241,7 +241,7 @@ def displayStatus(detailed):
else:
stGetStatus = '''
SELECT StageRepackRequest.creationTime, StageRepackRequest.lastModificationTime, StageRepackRequest.username,
StageRepackRequest.machine, StageRepackRequest.repackVID, StageRepackRequest.status,
StageRepackRequest.repackVID, StageRepackRequest.status,
StageRepackRequest.fileCount total, StageRepackRequest.totalSize totsize,
SUM(CASE WHEN SubRequest.status IN (4, 5) THEN 1 ELSE 0 END) toRecall,
SUM(CASE SubRequest.status WHEN 12 THEN 1 ELSE 0 END) toMigr,
......@@ -254,7 +254,7 @@ def displayStatus(detailed):
stGetStatus += "AND StageRepackRequest.repackVID IN ('" + "','".join(vids) + "')"
stGetStatus += '''
GROUP BY StageRepackRequest.creationTime, StageRepackRequest.lastModificationTime, StageRepackRequest.username,
StageRepackRequest.machine, StageRepackRequest.repackVID, StageRepackRequest.status,
StageRepackRequest.repackVID, StageRepackRequest.status,
StageRepackRequest.fileCount, StageRepackRequest.totalSize'''
stGetStatus += ' ORDER BY StageRepackRequest.creationTime DESC'
# go to DB and get back the data
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment