diff --git a/tape-rest-api/libs/gfal_helper.py b/tape-rest-api/libs/gfal_helper.py index dd643ab4144398d8aa2077583ea4c0b31ec3b293..1c9671813a0b538faa788afaab192af2c9ad66d8 100644 --- a/tape-rest-api/libs/gfal_helper.py +++ b/tape-rest-api/libs/gfal_helper.py @@ -45,3 +45,22 @@ class GfalWrapper: # Request still not finished return 0, errors + def archive_poll_list(self, urls): + errors = self.context.archive_poll(urls) + error_count = 0 + ontape_count = 0 + + for error in errors: + if error is None: + ontape_count += 1 + elif error.code != errno.EAGAIN: + error_count += 1 + if error_count == len(errors): + return -1, errors + elif ontape_count == len(errors): + return 1, errors + elif (ontape_count + error_count) == len(errors): + return 2, errors + + # Request still not finished + return 0, errors