Eidolon
|
Inherits Process.
Public Member Functions | |
def | __init__ (self, index, total, syncEvent, syncEvent2, syncCounter, syncLock, sharer, progress, stopEvent, parentPID) |
def | __repr__ (self) |
def | shareObject (self, name, obj, doExchange=True) |
def | getObjects (self, name) |
def | sync (self) |
def | nrange (self) |
def | prange (self) |
def | setProgress (self, val, forceUpdate=False) |
def | run (self) |
Public Attributes | |
index | |
total | |
syncEvent | |
syncEvent2 | |
syncCounter | |
syncLock | |
sharer | |
progress | |
stopEvent | |
parentPID | |
startval | |
endval | |
maxval | |
recv | |
rrecv | |
progressTime | |
Private Member Functions | |
def | _continueRunning (self) |
This object represents a separate process as well as the mechanisms for sharing objects between them and synchronization. It is used by 'concurrentAlgorithm' and 'concurrent', and should not be instantiated separately.
def __init__ | ( | self, | |
index, | |||
total, | |||
syncEvent, | |||
syncEvent2, | |||
syncCounter, | |||
syncLock, | |||
sharer, | |||
progress, | |||
stopEvent, | |||
parentPID | |||
) |
def __repr__ | ( | self | ) |
|
private |
Returns True so long as the `stopEvent' is not set and the parent process has not exited.
def getObjects | ( | self, | |
name | |||
) |
Returns a dict mapping process IDs to the shared objects of the given name, excluding the current process' object. This will return {} if no shared objects of the given name isn't present or if the sharing object isn't present.
def nrange | ( | self | ) |
Returns an iterator from `self.startval' to `self.endval'-1.
def prange | ( | self | ) |
Yield each number from self.startval to self.endval-1 and update progress by calling setProgress().
def run | ( | self | ) |
Executes operations by unpacking instruction tuples from the receiving pipe and calling the appropriate function and then returning the results (or an exception) back through the sending pipe.
def setProgress | ( | self, | |
val, | |||
forceUpdate = False |
|||
) |
Sets the progress indicator value of the associated Task object or the shared value array, only updates if the previous update was more than 200ms in the past.
def shareObject | ( | self, | |
name, | |||
obj, | |||
doExchange = True |
|||
) |
Share the value 'obj' under the name 'name', returning the objects of the same name from other processes if 'doExchange' is true. The assumption is that all procs share objects of the same name at once and so this method will call sync(). It will not return the object for the current process.
def sync | ( | self | ) |
Causes the calling process to block until all others have also called this method. This synchronizes between multiple processes by incrementing the shared counter value `syncCounter'. Each process calls 'sync()' and is forced to wait until all other processes have done the same. This essentially functions as a concurrent checkpointing mechanism. If one process throws an exception then `syncCounter' is set to a negative value to indicate this, causing any proc which calls sync() in this case to throw an exception as well. If self.syncEvent is None then this method exits without doing anything, allowing it to be safely called in single-process operation. All processes MUST call this method at the same point in code otherwise deadlock will result.
endval |
index |
maxval |
parentPID |
progress |
progressTime |
recv |
rrecv |
sharer |
startval |
stopEvent |
syncCounter |
syncEvent |
syncEvent2 |
syncLock |
total |