def process(self): for fn in self.dataFiles: EDVerbose.screen("Processing file %s" % fn) edj = EDJob(self.EDNAPluginName) edj.dataInput = self.fileName2xml(fn) edj.connectSUCCESS(self.XMLsuccess) edj.connectFAILURE(self.XMLerr) self.queue.put(edj) if self.process_sem._Semaphore__value > 0 : t = threading.Thread(target=self.startProcessing) t.start() EDVerbose.screen("Back in main") while self.cpu_sem._Semaphore__value < self.nbcpu: time.sleep(0.1) EDJob.synchronizeAll() EDJob.stats()
def start(self, _strXmlInput): """ Launch EDNA with the given XML stream @param _strXmlInput: XML to be passed to the plugin @type _strXmlInput: python string representing the XML data structure """ jobid = None if _strXmlInput not in ["", None]: job = EDJob(self.__strPluginName) job.setDataInput(_strXmlInput) job.connectFAILURE(self.failureJobExecution) job.connectSUCCESS(self.successJobExecution) job.connectCallBack(self.unregisterJob) self.semaphoreNbThreadsAcquire() jobid = job.execute() self.DEBUG("Running Job id %s" % jobid) if jobid is None: self.semaphoreNbThreadsRelease() return jobid