From 18308ef9787bc45330bf08477c4c5c513491257e Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Wed, 2 Mar 2011 13:34:45 +0100 Subject: [PATCH] Return some useful values from scan_all(). Signed-off-by: Torsten Werner --- daklib/contents.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 } -- 2.39.2