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

Class ClusterServer

source code

Instance Methods [hide private]
 
__init__(self, name, maxsize=None, docode=False, bindsrc="", cobrad=None)
The cluster server is the core of the code that manages work units.
source code
 
addClusterQueen(self, queenhost)
Inform the ClusterServer about the presence of a ClusterQueen instance on the given host.
source code
 
shareFileToWorkers(self, filename)
Add a file to the list of files which are "shared" to worker clients.
source code
 
openSharedFile(self, filename)
Return a URI for an open file decriptor for the specified filename.
source code
 
__touchWork(self, workid) source code
 
__cleanWork(self, workid) source code
 
timerThread(self) source code
 
shutdownServer(self) source code
 
announceWork(self)
Announce to our multicast cluster peers that we have work to do! (Or use a queen to proxy to them...)
source code
 
runServer(self, firethread=False) source code
 
inQueueCount(self)
How long is the current work unit queue.
source code
 
inProgressCount(self)
How many work units are in progress?
source code
 
addWork(self, work)
Add a work object to the ClusterServer.
source code
 
getWork(self) source code
 
doneWork(self, work)
Used by the clients to report work as done.
source code
 
timeoutWork(self, work)
This method may be over-ridden to handle work units that time our for whatever reason.
source code
 
failWork(self, work)
This is called for a work unit that is in a failed state.
source code
 
cancelAllWork(self, inprog=True)
Cancel all of the currently pending work units.
source code
 
cancelWork(self, workid)
Cancel a work unit by ID.
source code
 
setWorkStatus(self, workid, status)
Set the humon readable status for the given work unit.
source code
 
setWorkCompletion(self, workid, percent)
Set the percentage completion status for this work unit.
source code
Method Details [hide private]

__init__(self, name, maxsize=None, docode=False, bindsrc="", cobrad=None)
(Constructor)

source code 

The cluster server is the core of the code that manages work units.

Arguments:
    maxsize - How big should the work queue be before add blocks
    docode  - Should we also be a dcode server?
    bindsrc - Should we bind a src IP for our multicast announcements?
    cobrad  - Should we use an existing cobra daemon to share our objects?

addClusterQueen(self, queenhost)

source code 

Inform the ClusterServer about the presence of a ClusterQueen instance on the given host. When the ClusterServer begins to announce work, he will do so in "infrastructure mode" and ask any set queens for help.

shareFileToWorkers(self, filename)

source code 

Add a file to the list of files which are "shared" to worker clients.
This allows workers to access a file from the server.

Example:
    s.shareFileToWorkers('/path/to/file')

NOTE: Workers may use the openSharedFile() API to access them.

openSharedFile(self, filename)

source code 

Return a URI for an open file decriptor for the specified filename.

NOTE: use openSharedFile() method on work unit to get back a proxy.

addWork(self, work)

source code 

Add a work object to the ClusterServer. This

failWork(self, work)

source code 

This is called for a work unit that is in a failed state. This is most commonly that the work() method has raised an exception.

cancelAllWork(self, inprog=True)

source code 

Cancel all of the currently pending work units. You may specify inprog=False to cancel all *queued* work units but allow inprogress work units to complete.