Exemplo n.º 1
0
    def update(self, folder, window):
        """This function represents the analysis and restore process core."""

        count = 0
        cfg = ConfigParser.ConfigParser()
        cfg.read(config.configFile)
        duration = cfg.get('Analysis', 'duration')

        while True:
            if self.exit() or not bool(self._dict):
                break

            self._logger.info('current state -> %s' % 'running')

            #create folder to store analysis results
            count += 1
            exp_f = self.createFolder(self.getDeviceId(), folder, count)

            #create the wrapper class
            key, l_app = self._dict.popitem()
            exp = Analysis(exp_f, self.getDeviceId(), self._shell, window)
            exp.addApks(l_app)

            #self._logger.info('give root privileges to shell')
            #self.getShell().root()
            #sleep(2)

            ###
            try:
                #update the partitions
                ###runtime = UpdateManagerDevice(self.getDeviceId())
                ###runtime.startUpdate()

                #perform the experiment setup
                exp.setup()

                #perform the analysis
                exp.start()
            except:
                self._logger.error('Unable to perform the analysis',
                                   exc_info=True)
                #do something

            finally:

                #wait the update process
                self._logger.info('Wait update_device process')
                #runtime.join()
                self._logger.info('update_device process joined')

                self._logger.info('Wait experiment process')
                exp.getProcess().join(int(duration))
                #if exp.getMessage() == 'ERROR':
                #    self.reportCrash()
                #    try:
                #        exp.join()
                #        exp.terminate()
                #    except:
                #        pass

                self._logger.info('experiment process joined')

                #before to perform the restore process check if the user has stopped the analysis
                if self.exit():
                    break

                self._logger.info('Start restore process')
                ###self.restore()
                self._logger.info('End restore process')

                #slow down the process
                self._logger.info('wait 15 seconds')
                sleep(15)  # wait the device

        print 'Analysis finished for DeviceId', self.getDeviceId()
        self._logger.info('current state -> %s' % 'ready')
Exemplo n.º 2
0
    def update(self, folder, window):
        """This function represents the analysis and restore process core."""

        count = 0
        cfg = ConfigParser.ConfigParser()
        cfg.read(config.configFile)
        duration = cfg.get('Analysis', 'duration')

        while True:
            if self.exit() or not bool(self._dict):
                break

            self._logger.info('current state -> %s' % 'running')

            #create folder to store analysis results
            count += 1
            exp_f = self.createFolder(self.getDeviceId(), folder, count)

            #create the wrapper class
            key, l_app = self._dict.popitem()
            exp = Analysis(exp_f, self.getDeviceId(), self._shell, window)
            exp.addApks(l_app)

            #self._logger.info('give root privileges to shell')
            #self.getShell().root()
            #sleep(2)

            ###
            try:
                #update the partitions
                ###runtime = UpdateManagerDevice(self.getDeviceId())
                ###runtime.startUpdate()
                
                #perform the experiment setup
                exp.setup()

                #perform the analysis
                exp.start()
            except:
                self._logger.error('Unable to perform the analysis', exc_info=True)
                #do something
            
            finally:

                #wait the update process
                self._logger.info('Wait update_device process') 
                #runtime.join()
                self._logger.info('update_device process joined') 

                self._logger.info('Wait experiment process')
                exp.getProcess().join(int(duration))
                #if exp.getMessage() == 'ERROR':
                #    self.reportCrash()
                #    try:
                #        exp.join()
                #        exp.terminate()
                #    except:
                #        pass

                self._logger.info('experiment process joined')

                #before to perform the restore process check if the user has stopped the analysis
                if self.exit():
                    break

                self._logger.info('Start restore process') 
                ###self.restore()
                self._logger.info('End restore process') 

                #slow down the process
                self._logger.info('wait 15 seconds')
                sleep(15) # wait the device
        
        print 'Analysis finished for DeviceId', self.getDeviceId()
        self._logger.info('current state -> %s' % 'ready')