def __init__(self, protocol, **kwargs): Monitor.__init__(self, **kwargs) # The movieGain protocol to monitor self.protocol = protocol self.stddevValue = kwargs['stddevValue'] self.ratio1Value = kwargs['ratio1Value'] self.ratio2Value = kwargs['ratio2Value']
def __init__(self, protocols, **kwargs): Monitor.__init__(self, **kwargs) self.protocols = protocols self.cpuAlert = kwargs['cpuAlert'] self.memAlert = kwargs['memAlert'] self.swapAlert = kwargs['swapAlert'] self._dataBase = kwargs.get('dbName', SYSTEM_LOG_SQLITE) self._tableName = kwargs.get('tableName', 'log') self.conn = lite.connect(os.path.join(self.workingDir, self._dataBase), isolation_level=None) self.cur = self.conn.cursor()
def __init__(self, protocols, **kwargs): Monitor.__init__(self, **kwargs) self.protocols = protocols self.cpuAlert = kwargs['cpuAlert'] self.memAlert = kwargs['memAlert'] self.swapAlert = kwargs['swapAlert'] self._dataBase = kwargs.get('dbName', SYSTEM_LOG_SQLITE) self._tableName = kwargs.get('tableName', 'log') self.doGpu = kwargs['doGpu'] self.doNetwork = kwargs['doNetwork'] self.doDiskIO = kwargs['doDiskIO'] self.samplingTime = 1. # seconds self.labelList = ["cpu", "mem", "swap"] if self.doGpu: self.gpuLabelList = [] # get Gpus to monitor self.gpusToUse = [int(n) for n in (kwargs['gpusToUse']).split()] for i in self.gpusToUse: self.gpuLabelList.append("gpuMem_%d" % i) self.gpuLabelList.append("gpuUse_%d" % i) self.gpuLabelList.append("gpuTem_%d" % i) # init GPUs nvmlInit() self.labelList += self.gpuLabelList else: self.gpusToUse = None if self.doNetwork: self.nif = kwargs['nif'] self.netLabelList = [] # in the future we may display # all the network interfaces self.netLabelList.append("%s_send" % self.nif) self.netLabelList.append("%s_recv" % self.nif) self.labelList += self.netLabelList else: self.nif = None if self.doDiskIO: self.netLabelList = [] # in the future we may display # all the network interfaces self.netLabelList.append("disk_read") self.netLabelList.append("disk_write") self.labelList += self.netLabelList else: pass self.conn = lite.connect(os.path.join(self.workingDir, self._dataBase), isolation_level=None) self.cur = self.conn.cursor()
def __init__(self, protocol, **kwargs): Monitor.__init__(self, **kwargs) # The CTF protocol to monitor self.protocol = protocol self.maxDefocus = kwargs['maxDefocus'] self.minDefocus = kwargs['minDefocus'] self.astigmatism = kwargs['astigmatism'] self._dataBase = kwargs.get('dbName', CTF_LOG_SQLITE) self._tableName = kwargs.get('tableName', 'log') self.readCTFs = set() self.conn = lite.connect(os.path.join(self.workingDir, self._dataBase), isolation_level=None) self.cur = self.conn.cursor()
def monitorStep(self): # create monitors movieGainMonitor = self.createMovieGainMonitor() ctfMonitor = self.createCtfMonitor() sysMonitor = self.createSystemMonitor() reportHtml = self.createHtmlReport(ctfMonitor, sysMonitor, movieGainMonitor) monitor = Monitor(workingDir=self.workingDir.get(), samplingInterval=self.samplingInterval.get(), monitorTime=self.monitorTime.get()) def initAll(): if ctfMonitor is not None: ctfMonitor.initLoop() if movieGainMonitor is not None: movieGainMonitor.initLoop() sysMonitor.initLoop() def stepAll(): finished = False try: if ctfMonitor is not None: # Call ctf monitor step ctfMonitor.step() if movieGainMonitor is not None: # Call movie gain step movieGainMonitor.step() # sysmonitor watches all input protocols so # when sysmonitor done all protocols done sysMonitorFinished = sysMonitor.step() htmlFinished = reportHtml.generate(finished) if sysMonitorFinished and htmlFinished: finished = True reportHtml.generate(finished) except Exception as ex: print("An error happened: %s" % ex) return finished monitor.initLoop = initAll monitor.step = stepAll monitor.loop()
def __init__(self, protocol, **kwargs): Monitor.__init__(self, **kwargs) self.protocol = protocol self.project = protocol.getProject() self.run_count = 1 self.compress = kwargs['compress'] if kwargs['transferMethod'] == 0: self.transferMethod = 'scp' elif kwargs['transferMethod'] == 1: self.transferMethod = 'bbcp' self.destinationHost = kwargs['destinationHost'] self.destinationDirectory = kwargs['destinationDirectory'] if not self.destinationDirectory: self.destinationDirectory = '' self.destinationUser = kwargs['destinationUser'] self.password = None
def monitorStep(self): ctfMonitor = self.createCtfMonitor() sysMonitor = self.createSystemMonitor() reportHtml = self.createHtmlReport(ctfMonitor, sysMonitor) monitor = Monitor(workingDir=self.workingDir.get(), samplingInterval=self.samplingInterval.get(), monitorTime=self.monitorTime.get()) def initAll(): if ctfMonitor is not None: ctfMonitor.initLoop() sysMonitor.initLoop() def stepAll(): finished = False try: if ctfMonitor is not None: # FIXME: finished should be True if all monitored protocols # are finished, failed or aborted finished = ctfMonitor.step() sysMonitor.step() reportHtml.generate(finished) except Exception as ex: print "An error happened: %s" % ex # Stop when the CTF monitor is done return finished monitor.initLoop = initAll monitor.step = stepAll monitor.loop()
def monitorStep(self): # create monitors movieGainMonitor = self.createMovieGainMonitor() ctfMonitor = self.createCtfMonitor() sysMonitor = self.createSystemMonitor() reportHtml = self.createHtmlReport(ctfMonitor, sysMonitor, movieGainMonitor) monitor = Monitor(workingDir=self.workingDir.get(), samplingInterval=self.samplingInterval.get(), monitorTime=self.monitorTime.get()) def initAll(): if ctfMonitor is not None: ctfMonitor.initLoop() if movieGainMonitor is not None: movieGainMonitor.initLoop() sysMonitor.initLoop() def stepAll(): finished = False try: if ctfMonitor is not None: # Call ctf monitor step ctfMonitor.step() if movieGainMonitor is not None: # Call movie gain step movieGainMonitor.step() # sysmonitor watches all input protocols so # when sysmonitor done all protocols done sysMonitorFinished = sysMonitor.step() htmlFinished = reportHtml.generate(finished) if sysMonitorFinished and htmlFinished: finished = True reportHtml.generate(finished) except Exception as ex: print("An error happened:") import traceback traceback.print_exc() return finished monitor.initLoop = initAll monitor.step = stepAll monitor.loop()
def __init__(self, protocol, **kwargs): Monitor.__init__(self, **kwargs) self.protocol = protocol self.project = protocol.getProject() self.run_count = 1