[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master 2/5] Return some useful values from scan_all().



Signed-off-by: Torsten Werner <twerner@debian.org>
---
 daklib/contents.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/daklib/contents.py b/daklib/contents.py
index 740c0b2..ed982d8 100755
--- a/daklib/contents.py
+++ b/daklib/contents.py
@@ -210,14 +210,19 @@ class ContentsScanner(object):
         '''
         The class method scan_all() scans all binaries using multiple threads.
         The number of binaries to be scanned can be limited with the limit
-        argument.
+        argument. Returns the number of processed and remaining packages as a
+        dict.
         '''
         session = DBConn().session()
         query = session.query(DBBinary).filter(DBBinary.contents == None)
+        remaining = query.count
         if limit is not None:
             query = query.limit(limit)
+        processed = query.count()
         threadpool = ThreadPool()
         for binary in query.yield_per(100):
             threadpool.queueTask(ContentsScanner(binary).scan)
         threadpool.joinAll()
+        remaining = remaining()
         session.close()
+        return { 'processed': processed, 'remaining': remaining }
-- 
1.7.2.3



Reply to: