]> git.decadent.org.uk Git - dak.git/commitdiff
Return some useful values from scan_all().
authorTorsten Werner <twerner@debian.org>
Wed, 2 Mar 2011 12:34:45 +0000 (13:34 +0100)
committerTorsten Werner <twerner@debian.org>
Wed, 2 Mar 2011 12:34:45 +0000 (13:34 +0100)
Signed-off-by: Torsten Werner <twerner@debian.org>
daklib/contents.py

index 740c0b2942951a5ff6f38df9581e9dd376698222..ed982d8dabfac25c3d97b18e479b15cfa75073f3 100755 (executable)
@@ -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 }