diff --git a/tools/lib/logreader.py b/tools/lib/logreader.py index 6c1174611b..d6c1cc90c2 100755 --- a/tools/lib/logreader.py +++ b/tools/lib/logreader.py @@ -161,12 +161,14 @@ def direct_source(file_or_url): return [file_or_url] def get_invalid_files(files): - return [f for f in files if f is None or not file_exists(f)] + for f in files: + if f is None or not file_exists(f): + yield f def check_source(source, *args): try: files = source(*args) - assert len(get_invalid_files(files)) == 0 + assert next(get_invalid_files(files), None) is None return True, files except Exception: return False, None @@ -177,7 +179,6 @@ def auto_source(*args): valid, ret = check_source(source, *args) if valid: return ret - return comma_api_source(*args) def parse_useradmin(identifier): @@ -256,7 +257,7 @@ class LogReader: def reset(self): self.logreader_identifiers = self._parse_identifiers(self.identifier) - invalid_count = len(get_invalid_files(self.logreader_identifiers)) + invalid_count = len(list(get_invalid_files(self.logreader_identifiers))) assert invalid_count == 0, f"{invalid_count}/{len(self.logreader_identifiers)} invalid log(s) found, please ensure all logs \ are uploaded or auto fallback to qlogs with '/a' selector at the end of the route name."