class GenThreadExecutor(abc.ABC): ## Common base __init__ method. def __init__(self): self.mSingleThreadDispatcher = SingleThreadDispatcher() def getDispatcher(self): return self.mSingleThreadDispatcher ## Notify the exeuctor of the main generator thread ID for the before and after main test # processing. def setMainThreadId(self, aThreadId): self.mSingleThreadDispatcher.addThreadId(aThreadId) ## Interface method to execute generator threads. # @abc.abstractmethod def executeGenThreads(self, aGenThreads): raise NotImplementedError ## Static method used by base classes to execute a generator thread. # @staticmethod def executeGenThread(aGenThread): try: aGenThread.setup() aGenThread.generate() aGenThread.cleanUp() except Exception as exc: err_str = traceback.format_exception_only(type(exc), exc)[-1] err_str += ''.join(traceback.format_tb(exc.__traceback__)) Log.fail(err_str)
def __init__(self): self.mSingleThreadDispatcher = SingleThreadDispatcher()