r7342 - dumbhippo/trunk/firehose/firehose/jobs



Author: walters
Date: 2008-02-23 12:12:59 -0600 (Sat, 23 Feb 2008)
New Revision: 7342

Modified:
   dumbhippo/trunk/firehose/firehose/jobs/poller.py
Log:
Quiet network errors.  Ensure we send results even if some were errors.


Modified: dumbhippo/trunk/firehose/firehose/jobs/poller.py
===================================================================
--- dumbhippo/trunk/firehose/firehose/jobs/poller.py	2008-02-22 22:44:39 UTC (rev 7341)
+++ dumbhippo/trunk/firehose/firehose/jobs/poller.py	2008-02-23 18:12:59 UTC (rev 7342)
@@ -124,9 +124,11 @@
     @log_except(_logger)        
     def __run_collect_tasks(self, resultcount, resultqueue, masterhost):
         results = []
+        received_count = 0
         _logger.debug("expecting %r results", resultcount)
-        while len(results) < resultcount:
+        while received_count < resultcount:
             result = resultqueue.get()
+            received_count += 1
             if result is not None:
                 results.append(result)     
         _logger.debug("sending %d results", len(results))            
@@ -143,12 +145,13 @@
         inst = fclass()
         try:
             (new_hash, new_timestamp) = inst.run(tid, prev_hash, prev_timestamp)            
-        except:
-            _logger.exception("Failed task id %r", tid)
+        except Exception, e:
+            _logger.error("Failed task id %r: %s", tid, e)
             (new_hash, new_timestamp) = (None, None)
         if new_hash is not None:
             resultqueue.put((taskid, new_hash, new_timestamp))
-        resultqueue.put(None)
+        else:
+            resultqueue.put(None)
         
     def poll_tasks(self, tasks, masterhost):
         taskcount = 0



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