perceval/backends/core/jenkins.py
def fetch_items(self, category, **kwargs):
        """Fetch the contents

        :param category: the category of items to fetch
        :param kwargs: backend arguments

        :returns: a generator of items
        """
        logger.info("Looking for projects at url '%s'", self.url)

        nbuilds = 0  # number of builds processed
        njobs = 0  # number of jobs processed

        projects = json.loads(self.client.get_jobs())
        jobs = projects['jobs']

        for job in jobs:
            logger.debug("Adding builds from %s (%i/%i)",
                         job['url'], njobs, len(jobs))

            try:
                raw_builds = self.client.get_builds(job['name'])
            except requests.exceptions.HTTPError as e:
                if e.response.status_code == 500:
                    logger.warning(e)
                    logger.warning("Unable to fetch builds from job %s; skipping",
                                   job['url'])
                    continue
                else:
                    raise e

            if not raw_builds:
                continue

            try:
                builds = json.loads(raw_builds)
            except ValueError:
                logger.warning("Unable to parse builds from job %s; skipping",
                               job['url'])
                continue

            builds = builds['builds']
            for build in builds:
                yield build
                nbuilds += 1

            njobs += 1

        logger.info("Total number of jobs: %i/%i", njobs, len(jobs))
        logger.info("Total number of builds: %i", nbuilds)
def fetch_items(self, category, **kwargs):
        """Fetch the contents

        :param category: the category of items to fetch
        :param kwargs: backend arguments

        :returns: a generator of items
        """
        logger.info("Looking for projects at url '%s'", self.url)

        nbuilds = 0  # number of builds processed
        njobs = 0  # number of jobs processed

        projects = json.loads(self.client.get_jobs())
        jobs = projects['jobs']

        for job in jobs:
            logger.debug("Adding builds from %s (%i/%i)",
                         job['url'], njobs, len(jobs))

            try:
                raw_builds = self.client.get_builds(job['name'])
            except requests.exceptions.HTTPError as e:
                if e.response.status_code == 500:
                    logger.warning(e)
                    logger.warning("Unable to fetch builds from job %s; skipping",
                                   job['url'])
                    continue
                else:
                    raise e

            if not raw_builds:
                continue

            try:
                builds = json.loads(raw_builds)
            except ValueError:
                logger.warning("Unable to parse builds from job %s; skipping",
                               job['url'])
                continue

            builds = builds['builds']
            for build in builds:
                yield build
                nbuilds += 1

            njobs += 1

        logger.info("Total number of jobs: %i/%i", njobs, len(jobs))
        logger.info("Total number of builds: %i", nbuilds)
Fetch the contents

        :param category: the category of items to fetch
        :param kwargs: backend arguments

        :returns: a generator of items