Package cobra :: Module cluster :: Class ClusterWork
[hide private]
[frames] | no frames]

Class ClusterWork

source code


Extend this object to create your own work units. Do it in a proper module (and not __main__ to be able to use this in conjunction with cobra.dcode).

Instance Methods [hide private]
 
__init__(self, timeout=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
touch(self)
Update the internal "touch time" which is used by the timeout subsystem to see if this work unit has gone too long without making progress...
source code
 
isTimedOut(self)
Check if this work unit is timed out.
source code
 
work(self)
Actually do the work associated with this work object.
source code
 
done(self)
This is called back on the server once a work unit is complete and returned.
source code
 
setCompletion(self, percent)
Work units may call this whenever they like to tell the server how far along their work they are.
source code
 
setStatus(self, status)
Work units may call this to inform the server of their status.
source code
 
openSharedFile(self, filename)
A helper API to open a file like object on the server.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, timeout=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

openSharedFile(self, filename)

source code 

A helper API to open a file like object on the server.

Example:
    fd = self.openSharedFile('/foo/bar/baz')
    fbytes = fd.read()

NOTE: The server must use shareFileToWorkers().