本文整理汇总了Python中EDJob.EDJob类的典型用法代码示例。如果您正苦于以下问题:Python EDJob类的具体用法?Python EDJob怎么用?Python EDJob使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EDJob类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
def process(_listInputFile, _output, dummy=0, autoscale=False, center=None, width=None, blending=None, mask=None):
"""
call EDNA with this options:
@param _listInputFile: list of input files as strings
@param _output: output file name
@param dummy: value for dummy pixels
@param autoscale: shall image intensity be scaled (boolean)
@param center: 2-list of int representing the center of the ROI
@param width: 2-list of int representing the width of the ROI
@param blending: blending method: max, mean or min
@param mask: name of the file containing the mask
"""
xsd = XSDataInputStitchImage()
xsd.dummyValue = XSDataDouble(dummy)
xsd.autoscale = XSDataBoolean(autoscale)
if blending:
xsd.blending = XSDataString(blending)
if mask:
xsd.mask = XSDataImage(XSDataString(mask))
xsd.outputImage = XSDataImage(XSDataString(_output))
xsd.inputImages = [XSDataImage(XSDataString(i)) for i in _listInputFile]
if isinstance(width, list):
xsd.widthROI = [XSDataInteger(i) for i in width]
if isinstance(center, list):
xsd.centerROI = [XSDataInteger(i) for i in center]
job = EDJob(EDNAPluginName)
job.setDataInput(xsd)
job.execute()
示例2: successJobExecution
def successJobExecution(self, jobId):
self.DEBUG("In %s.successJobExecution(%s)" % (self.__class__.__name__, jobId))
with self.locked():
self.__semaphoreNbThreads.release()
EDJob.cleanJobfromID(jobId, False)
self.lastSuccess = jobId
gc.collect()
示例3: successJobExecution
def successJobExecution(self, jobId):
self.DEBUG("In %s.successJobExecution(%s)" % (self.get_name(), jobId))
with self.locked():
self.__semaphoreNbThreads.release()
EDJob.cleanJobfromID(jobId, False)
self.lastSuccess = jobId
self.push_change_event("jobSuccess", jobId)
gc.collect()
示例4: failureJobExecution
def failureJobExecution(self, jobId):
self.DEBUG("In %s.failureJobExecution(%s)" % (self.__class__.__name__, jobId))
with self.locked():
self.__semaphoreNbThreads.release()
EDJob.cleanJobfromID(jobId, False)
self.lastFailure = jobId
sys.stdout.flush()
sys.stderr.flush()
gc.collect()
示例5: unitTestSetGetData
def unitTestSetGetData(self):
"""
check the status after a job creation
"""
EDVerbose.DEBUG("EDTestCaseEDJob.unitTestSetGetData")
edJob = EDJob(self.strPluginName)
edJob.setDataInput(self.strXmlInput)
EDAssert.equal(self.strXmlInput, edJob.getDataInput().strip(), "Data Input is correctly set")
EDAssert.equal("uninitialized", edJob.getStatus(), "Job %s is still ''uninitialized''" % edJob.getJobId())
示例6: failureJobExecution
def failureJobExecution(self, jobId):
self.DEBUG("In %s.failureJobExecution(%s)" % (self.get_name(), jobId))
with self.locked():
self.__semaphoreNbThreads.release()
EDJob.cleanJobfromID(jobId, False)
self.lastFailure = jobId
self.push_change_event("jobFailure", jobId)
sys.stdout.flush()
sys.stderr.flush()
gc.collect()
示例7: waitForAllProcessToFinish
def waitForAllProcessToFinish(self):
"""
as it names says, this method waits for all plug-ins which are currently running to finish before returning.
"""
self.screen("Waiting for launched jobs to finish .")
while (self.getNbRunning() > 0):
time.sleep(1)
sys.stderr.write(".")
sys.stderr.write("Done.\n")
EDJob.stats()
示例8: unitTestInitialState
def unitTestInitialState(self):
"""
check the status after a job creation
"""
EDVerbose.DEBUG("EDTestCaseEDJob.unitTestInitialState")
edJob = EDJob(self.strPluginName)
strJobId = edJob.getJobId()
EDVerbose.DEBUG("EDJobId is: %s" % strJobId)
EDAssert.equal(2, len(strJobId.split("-")), "JobID is composed of 2 parts")
EDAssert.equal(True, strJobId.split("-")[1].isdigit(), "JobID's second part is an integer")
EDAssert.equal("uninitialized", edJob.getStatus(), "Initial stat is ''uninitialized''")
示例9: getJobOutput
def getJobOutput(self, jobId):
"""
Retrieve XML output form a job
@param jobId: name of the job
@return: output from a job
"""
return EDJob.getDataOutputFromId(jobId)
示例10: getJobInput
def getJobInput(self, jobId):
"""
Retrieve XML input from a job
@param jobId: name of the job
@return: xml input from a job
"""
return EDJob.getDataInputFromId(jobId)
示例11: startJob
def startJob(self, argin):
"""
@param argin: 2-list [ "EDPluginName", "<xml/><XSDataInputPluginName>...."]
@return: jobID which is a sting: Plugin-000001
"""
self.DEBUG("In %s.startJob()" % self.get_name())
name, xsd = argin[:2]
if xsd.strip() == "":
return
edJob = EDJob(name)
if edJob is None:
return "Error in load Plugin"
jobId = edJob.getJobId()
edJob.setDataInput(xsd)
self.jobQueue.put(edJob)
return jobId
示例12: process
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()
示例13: callBack
def callBack(self, _strJobId):
"""
Example of Call Back function ...
"""
myJob = EDJob.getJobFromID(_strJobId)
strOutput = myJob.getDataOutput().strip()
EDAssert.equal(strOutput, self.strXmlInput, "From Callback: Output is OK")
EDAssert.equal("success", myJob.getStatus(), "From Callback: Job %s is finished with ''success''" % _strJobId)
示例14: statistics
def statistics(self):
"""
retrieve some statistics about past jobs.
"""
with self.statLock:
fStartStat = time.time()
self.lastStatistics = EDJob.stats()
self.lastStatistics += os.linesep + "Statistics collected on %s, the collect took: %.3fs" % (time.asctime(), time.time() - fStartStat)
return self.lastStatistics
示例15: start
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