def test_from_htcfile(self): htcfile = HTCFile( self.tfp + 'logfiles/model/htc/dlc14_iec61400-1ed3/dlc14_wsp10_wdir000_s0000.htc', "../") logfile = LogFile.from_htcfile(htcfile, self.tfp + 'logfiles/model/') self.assertEqual(logfile.status, DONE)
def _simulate(self): """starts blocking simulation""" self.sim.logFile = LogInfo(log_file.MISSING, 0, "None", "") self.pbsjob.submit("%s.in" % self.simulation_id, self.tmp_exepath, self.sim.stdout_filename) sleeptime = 1 while self.is_simulating: time.sleep(sleeptime) local_out_file = self.exepath + self.stdout_filename with self.ssh: try: self.ssh.download(self.tmp_exepath + self.stdout_filename, local_out_file) with open(local_out_file) as fid: _, self.stdout, returncode_str, _ = fid.read().split( "---------------------") self.returncode = returncode_str.strip() != "0" except Exception: self.returncode = 1 self.stdout = "error: Could not download and read stdout file" try: self.ssh.download(self.tmp_exepath + self.log_filename, self.exepath + self.log_filename) except Exception: raise Warning("Logfile not found", self.tmp_modelpath + self.log_filename) self.sim.logFile = LogFile.from_htcfile(self.htcFile, self.exepath)
def test_reset(self): htcfile = HTCFile( self.tfp + 'logfiles/model/htc/dlc14_iec61400-1ed3/dlc14_wsp10_wdir000_s0000.htc', "../") logfile = LogFile.from_htcfile(htcfile, self.tfp + 'logfiles/model/') self.assertEqual(logfile.status, DONE) logfile.reset() self.assertEqual(logfile.status, UNKNOWN) self.assertEqual(logfile.txt, "") logfile.update_status() self.assertEqual(logfile.status, DONE)