diff --git a/swh/lister/bitbucket/tasks.py b/swh/lister/bitbucket/tasks.py --- a/swh/lister/bitbucket/tasks.py +++ b/swh/lister/bitbucket/tasks.py @@ -2,6 +2,7 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information +import logging import random from celery import group @@ -11,6 +12,8 @@ GROUP_SPLIT = 10000 +logger = logging.getLogger(__name__) + def new_lister(api_baseurl='https://api.bitbucket.org/2.0', per_page=100): return BitBucketLister(api_baseurl=api_baseurl, per_page=per_page) @@ -39,11 +42,11 @@ random.shuffle(ranges) promise = group(range_bitbucket_lister.s(minv, maxv, **lister_args) for minv, maxv in ranges)() - self.log.debug('%s OK (spawned %s subtasks)' % (self.name, len(ranges))) + logger.debug('%s OK (spawned %s subtasks)', (self.name, len(ranges))) try: promise.save() # so that we can restore the GroupResult in tests except (NotImplementedError, AttributeError): - self.log.info('Unable to call save_group with current result backend.') + logger.info('Unable to call save_group with current result backend.') return promise.id diff --git a/swh/lister/core/indexing_lister.py b/swh/lister/core/indexing_lister.py --- a/swh/lister/core/indexing_lister.py +++ b/swh/lister/core/indexing_lister.py @@ -148,8 +148,6 @@ t = self.db_session.query(func.min(self.MODEL.indexable)).first() if t: return t[0] - else: - return None def db_last_index(self): """Look in the db for the largest indexable value @@ -160,8 +158,6 @@ t = self.db_session.query(func.max(self.MODEL.indexable)).first() if t: return t[0] - else: - return None def disable_deleted_repo_tasks(self, start, end, keep_these): """Disable tasks for repos that no longer exist between start and end. @@ -222,11 +218,12 @@ index) return index = next_index + logger.debug('Index: %s', index) yield i for i in ingest_indexes(): if (i % 20) == 0: - logger.info('flushing updates') + logger.info('flushing updates at index %s', i) self.db_session.commit() self.db_session = self.mk_session()