예제 #1
0
    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()
예제 #2
0
    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()
예제 #3
0
    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()