From e5c355903323b58f06110c34e1eb080f7a5283ab Mon Sep 17 00:00:00 2001 From: David Douard Date: Thu, 11 Apr 2019 11:01:26 +0200 Subject: [PATCH] tasks: fix handling of unsupported promise.save() calls the exception can also be an AttributeError. Also do not reraise this exception (in github/tasks.py). This promise saving feature is used for tests. --- swh/lister/bitbucket/tasks.py | 2 +- swh/lister/github/tasks.py | 3 +-- swh/lister/gitlab/tasks.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/swh/lister/bitbucket/tasks.py b/swh/lister/bitbucket/tasks.py index 98be1ac..9985b48 100644 --- a/swh/lister/bitbucket/tasks.py +++ b/swh/lister/bitbucket/tasks.py @@ -38,7 +38,7 @@ def full_bitbucket_relister(self, split=None, **lister_args): self.log.debug('%s OK (spawned %s subtasks)' % (self.name, len(ranges))) try: promise.save() # so that we can restore the GroupResult in tests - except NotImplementedError: + except (NotImplementedError, AttributeError): self.log.info('Unable to call save_group with current result backend.') return promise.id diff --git a/swh/lister/github/tasks.py b/swh/lister/github/tasks.py index 97dfad5..7d91dc9 100644 --- a/swh/lister/github/tasks.py +++ b/swh/lister/github/tasks.py @@ -38,9 +38,8 @@ def full_github_relister(self, split=None, **lister_args): self.log.debug('%s OK (spawned %s subtasks)' % (self.name, len(ranges))) try: promise.save() # so that we can restore the GroupResult in tests - except NotImplementedError: + except (NotImplementedError, AttributeError): self.log.info('Unable to call save_group with current result backend.') - raise return promise.id diff --git a/swh/lister/gitlab/tasks.py b/swh/lister/gitlab/tasks.py index 9e57081..aee2c19 100644 --- a/swh/lister/gitlab/tasks.py +++ b/swh/lister/gitlab/tasks.py @@ -47,7 +47,7 @@ def full_gitlab_relister(self, **lister_args): self.log.debug('%s OK (spawned %s subtasks)' % (self.name, len(ranges))) try: promise.save() - except NotImplementedError: + except (NotImplementedError, AttributeError): self.log.info('Unable to call save_group with current result backend.') return promise.id