Package pyworker :: Module pyworker :: Class PollingWorker
[hide private]
[frames] | no frames]

Class PollingWorker

source code

object --+    
         |    
    Worker --+
             |
            PollingWorker

Instance Methods [hide private]
 
__init__(self, queue_stdin, queue_stdout=None, polling_wait=60, **kw)
PollingWorker is built on the base Worker class.
source code
 
run(self) source code

Inherited from Worker: endtask, parse_json_msg, starttask

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, queue_stdin, queue_stdout=None, polling_wait=60, **kw)
(Constructor)

source code 

PollingWorker is built on the base Worker class.

The main difference is that it doesn't expect that the 'queue-in' object will provide a get method that blocks until it recieves a message.

It will wait for 'polling_time' (default: 60 seconds) and then call the get method. If the method returns a value that evaluates to False, then the worker is put to sleep for the polling_time again to try again.

The wait is performed by "time.sleep(polling_wait)"

If a message of any sort is received, then the message is passed through the normal pattern of starttask/endtask.
Overrides: Worker.__init__

run(self)

source code 
Overrides: Worker.run