def execute(self, args=None):
        self.logger.debug('Running ' + self.file)

        try:
            start = time.time()

            proc = subprocess.Popen([self.plugin_path + '/' + self.file],
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)

            successful = False
            stdout, stderr = proc.communicate()

            if proc.returncode is 0:
                for line in stdout.split('\n'):
                    match = re.match(r'^([^ ]+)\.value (.+)$', line)
                    if line and match:
                        (key, value) = match.groups()
                        self.datastore.push(key, value)
                        successful = True

                if not successful:
                    self.logger.warn('No valid output from ' + self.file)
            else:
                code = proc.returncode
                self.logger.error('Plugin returned with exit code %s' % code)

            elapsed = time.time() - start

            # Warn if execution takes more time than the interval
            if elapsed > self.interval:
                params = (self.interval, round(elapsed), self.file)
                message = 'Execution exceeds interval (%ss > %ss): %s' % params
                self.logger.warn(message)

        except __HOLE__:
            self.logger.error('Failed to execute plugin: ' + self.file)
dataset/ETHPy150Open tiwilliam/syscollect/syscollect/plugin.py/Plugin.execute