Skip to content
Snippets Groups Projects
Commit df0c5a6f authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

cluster_simulation updated

parent d908b6bb
No related branches found
No related tags found
2 merge requests!6Clustertools,!5Clustertools
from wetb.hawc2.simulation import Simulation, SimulationThread, INITIALIZING, ERROR, FINISH
from wetb.hawc2.htc_file import HTCFile
from wetb.hawc2.log_file import LogFile
from wetb.hawc2 import log_file
import os
import sys
import time
from threading import Timer, Thread
class ClusterSimulation(Simulation):
def __init__(self, modelpath, htcfilename, hawc2exe="HAWC2MB.exe"):
Simulation.__init__(self, modelpath, htcfilename, hawc2exe=hawc2exe)
self.simulation_id = [f for f in os.listdir('.') if f.endswith('.in')][0][:-3]
self.simulationThread = SimulationThread(self, False)
self.thread = Thread(target=self.simulate)
self.start(1)
self.wait()
print (self.simulationThread.res[1])
sys.exit(self.simulationThread.res[0])
def update_status(self, *args, **kwargs):
Simulation.update_status(self, *args, **kwargs)
with open("/home/mmpe/.hawc2launcher/status_%s"%self.simulation_id,'w') as fid:
fid.write (";".join([self.status]+[str(getattr(self.logFile, v)) for v in ['status','pct','remaining_time','lastline']])+"\n")
def show_status(self):
pass
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment