perceval/backends/core/gerrit.py
def __execute_from_remote(self, cmd):
        """Execute gerrit command with retry if it fails"""

        result = None  # data result from the cmd execution
        retries = 0

        while retries < self.MAX_RETRIES:
            try:
                result = subprocess.check_output(cmd, shell=True)
                break
            except subprocess.CalledProcessError as ex:
                logger.error("gerrit cmd %s failed: %s", cmd, ex)
                time.sleep(self.RETRY_WAIT * retries)
                retries += 1

        if result is None:
            result = RuntimeError(cmd + " failed " + str(self.MAX_RETRIES) + " times. Giving up!")

        if self.archive:
            cmd = self.sanitize_for_archive(cmd)
            self.archive.store(cmd, None, None, result)

        if isinstance(result, RuntimeError):
            raise result

        return result
def __execute_from_remote(self, cmd):
        result = None  # data result from the cmd execution
        retries = 0

        while retries < self.MAX_RETRIES:
            try:
                result = subprocess.check_output(cmd, shell=True)
                break
            except subprocess.CalledProcessError as ex:
                logger.error("gerrit cmd %s failed: %s", cmd, ex)
                time.sleep(self.RETRY_WAIT * retries)
                retries += 1

        if result is None:
            result = RuntimeError(cmd + " failed " + str(self.MAX_RETRIES) + " times. Giving up!")

        if self.archive:
            cmd = self.sanitize_for_archive(cmd)
            self.archive.store(cmd, None, None, result)

        if isinstance(result, RuntimeError):
            raise result

        return result
def __execute_from_remote ( self , cmd ) : result = None # data result from the cmd execution retries = 0 while retries < self . MAX_RETRIES : try : result = subprocess . check_output ( cmd , shell = True ) break except subprocess . CalledProcessError as ex : logger . error ( "gerrit cmd %s failed: %s" , cmd , ex ) time . sleep ( self . RETRY_WAIT * retries ) retries += 1 if result is None : result = RuntimeError ( cmd + " failed " + str ( self . MAX_RETRIES ) + " times. Giving up!" ) if self . archive : cmd = self . sanitize_for_archive ( cmd ) self . archive . store ( cmd , None , None , result ) if isinstance ( result , RuntimeError ) : raise result return result
Execute gerrit command with retry if it fails
Execute gerrit command with retry if it fails