/usr/share/pyshared/deap/dtm/abstractCommManager.py is in python-deap 0.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | import threading
from abc import ABCMeta, abstractmethod, abstractproperty
class AbstractCommThread(threading.Thread):
__metaclass__ = ABCMeta
def __init__(self, recvQ, sendQ, mainThreadEvent, exitEvent, commReadyEvent, randomGenerator, cmdlineArgs):
threading.Thread.__init__(self)
self.recvQ = recvQ
self.sendQ = sendQ
self.exitStatus = exitEvent
self.msgSendTag = 2
self.wakeUpMainThread = mainThreadEvent
self.random = randomGenerator
self.commReadyEvent = commReadyEvent
self.cmdArgs = cmdlineArgs
self.traceMode = False
self.traceTo = None
@abstractproperty
def poolSize(self):
"""
Return the number of effective workers (for instance, with MPI, this
is the number of slots asked with the -n or -np option)
"""
pass
@abstractproperty
def workerId(self):
"""
Return an ID for this worker such as each worker gets a different ID.
This must be an immutable type (int, string, tuple, etc.)
"""
pass
@abstractproperty
def isRootWorker(self):
"""
Return True if this worker is the "root worker", that is the worker
which will start the main task. The position of this worker in the
hosts is not important, but one and only one worker should be
designated as the root worker (the others should receive False).
"""
pass
@abstractproperty
def isLaunchProcess(self):
"""
If this function returns True, the main thread will wait for the
termination of this thread, and then exit without executing any
task. This may be useful for the backends which have to launch
themselves the remote DTM processes.
"""
pass
@abstractmethod
def setTraceModeOn(self, xmlLogger):
"""
Used for logging purposes. The xmlLogger arg is an xml.etree object
which can be use by the backend to log some informations. The log
format is not currently specified, and the backend may choose to
ignore this call (and not log anything).
"""
pass
@abstractmethod
def iterOverIDs(self):
"""
Return an iterable over all the worker IDs. For instance, if your
workers IDs are integers between 0 and 63, it should then return
range(0,64).
"""
pass
@abstractmethod
def run(self):
"""
The main method, which will be call to start the communication backend.
This is the place where you should import your special modules, and
insert the communication loop.
"""
pass
|