Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
kupu.lint.Pool Class Reference

List of all members.

Public Member Functions

def __init__
def run
def handleResponse
def process
def shutdown

Public Attributes

 nThreads
 requestQueue
 responseQueue
 exitcode
 thread_pool

Detailed Description

Definition at line 82 of file lint.py.


Constructor & Destructor Documentation

def kupu.lint.Pool.__init__ (   self,
  nThreads 
)

Definition at line 83 of file lint.py.

00083 
00084     def __init__(self, nThreads):
00085         self.nThreads = nThreads
00086         self.requestQueue = Queue()
00087         self.responseQueue = Queue()
00088         self.exitcode = 0
00089         self.thread_pool = [
00090                 threading.Thread(target=self.run)
00091                 for i in range(nThreads)]
00092         for t in self.thread_pool:
00093             t.start()


Member Function Documentation

def kupu.lint.Pool.handleResponse (   self,
  item,
  data,
  rc 
)

Definition at line 102 of file lint.py.

00102 
00103     def handleResponse(self, item, data, rc):
00104         if rc is not None:
00105             if item in status:
00106                 del status[item]
00107             self.exitcode = max(self.exitcode, rc)
00108         print data

Here is the caller graph for this function:

def kupu.lint.Pool.process (   self,
  items 
)

Definition at line 109 of file lint.py.

00109 
00110     def process(self, items):
00111         items = list(items)
00112         for item in items:
00113             
00114              self.requestQueue.put(item)
00115         for dummy in items:
00116             item, (data, rc) = self.responseQueue.get()
00117             self.handleResponse(item, data, rc)

Here is the call graph for this function:

def kupu.lint.Pool.run (   self)

Definition at line 94 of file lint.py.

00094 
00095     def run(self):
00096         for item in iter(self.requestQueue.get, None):
00097             if not self.exitcode:
00098                 self.responseQueue.put([item, lint(item)])
00099             else:
00100                 # Error state, just ignore this item
00101                 self.responseQueue.put([item, ("skipped %s" % item, 1)])

Here is the call graph for this function:

def kupu.lint.Pool.shutdown (   self)

Definition at line 118 of file lint.py.

00118 
00119     def shutdown(self):
00120         # and then to shut down the threads when you've finished:
00121         for t in self.thread_pool:
00122             self.requestQueue.put(None)
00123         for t in self.thread_pool:
00124              t.join()


Member Data Documentation

Definition at line 87 of file lint.py.

Definition at line 84 of file lint.py.

Definition at line 85 of file lint.py.

Definition at line 86 of file lint.py.

Definition at line 88 of file lint.py.


The documentation for this class was generated from the following file: