swh.lister.core.paging_lister: Adding comments

This commit is contained in:
Antoine R. Dumont (@ardumont) 2018-07-11 18:29:38 +02:00
parent 74d8375261
commit d520891547
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8
2 changed files with 6 additions and 4 deletions

View file

@ -82,6 +82,8 @@ class PageByPageLister(SWHListerBase):
def check_existence(self, injected_repos):
"""Given a list of injected repos, check if we already have them.
Attribute 'instance' variable is assumed to be populated.
"""
# FIXME: Implement the check
return False

View file

@ -54,12 +54,12 @@ class IncrementalGitLabLister(ListerTaskBase):
def new_lister(self, api_baseurl='https://gitlab.com/api/v4',
instance='gitlab.com'):
# will invert the order of the lister's result
# assuming going forward in desc order, page 1 through <x-total-pages>
return GitLabLister(instance=instance, api_baseurl=api_baseurl,
sort='desc')
def run_task(self, *args, **kwargs):
lister = self.new_lister(*args, **kwargs)
# will check for existing data and exit when found
return lister.run(min_bound=None, max_bound=None,
check_existence=True)
total, _, _ = lister.get_pages_information()
# stopping as soon as existing origins for that instance are detected
return lister.run(min_bound=1, max_bound=total, check_existence=True)