From: Torsten Werner Date: Wed, 2 Mar 2011 12:34:45 +0000 (+0100) Subject: Return some useful values from scan_all(). X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=18308ef9787bc45330bf08477c4c5c513491257e;p=dak.git Return some useful values from scan_all(). Signed-off-by: Torsten Werner --- diff --git a/daklib/contents.py b/daklib/contents.py index 740c0b29..ed982d8d 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 }