CPPUNIT_ASSERT(l.lastError().empty());
// This "wait" will end instantly because of the "ERROR" state.
bool ok = restoredJob->wait();
+ // ok means that the wait command succeeded. It is not the state of the job.
CPPUNIT_ASSERT(ok);
double progress = restoredJob->progress();
// We can check the progress in order to know if the job is done, but we
f.write(job_string)
def getResult(self):
+ """
+ Try to get the result file and if it was possible the results are loaded in
+ the sample.
+ An exception may be thrown if it was not possible to get the file.
+ """
if self.job_id < 0 :
raise Exception("Cannot get the results if the job is not created!")
launcher = salome.naming_service.Resolve('/SalomeLauncher')
self.sampleManager.getResultFileName(),
tmp_workdir):
self.sampleManager.loadResult(self.sample, tmp_workdir)
+ else:
+ raise Exception("Cannot get the result file!")
return self.sample
+ def resultAvailable(self):
+ """
+ Try to get the result and return True in case of success with no exception.
+ In case of success the results are loaded in the sample.
+ """
+ resultFound = False
+ try:
+ self.getResult()
+ resultFound = True
+ except:
+ resultFound = False
+ return resultFound
+
def getJobState(self):
if self.job_id < 0:
return "NOT_CREATED"
state = self.getJobState()
if state == "CREATED" or state == "QUEUED" :
return 0.0
- self.getResult();
+ if not self.resultAvailable():
+ return 0.0
return self.sample.progressRate()
def dump(self):