Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #12664 - donate-cpu-server.py: omit outdated results from diff reports #6349

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions tools/donate-cpu-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes)
SERVER_VERSION = "1.3.48"
SERVER_VERSION = "1.3.49"

OLD_VERSION = '2.14.0'

Expand Down Expand Up @@ -422,7 +422,7 @@ def diffReport(resultsPath: str) -> str:
for messageId in data['sums']:
sums = data['sums'][messageId]
if OLD_VERSION not in sums:
continue
break
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just bail out on the first occurrence of an old version because if one entry is outdated all of them are.

if messageId not in out:
out[messageId] = [0, 0]
out[messageId][0] += sums[OLD_VERSION]
Expand Down Expand Up @@ -490,9 +490,12 @@ def diffMessageIdReport(resultPath: str, messageId: str) -> str:
if not os.path.isfile(filename):
continue
with open(filename, 'rt') as f:
diff_stats = f.read()
if messageId not in diff_stats:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always checked the whole string for the occurrence. This might speed up things a bit if there was a lot of findings - unless it is offset by the added JSON loading.

diff_stats = json.loads(f.read())
if messageId not in diff_stats['sums']:
continue
if OLD_VERSION not in diff_stats['sums'][messageId]:
continue

url = None
diff = False
for line in open(filename[:-5], 'rt'):
Expand All @@ -518,11 +521,14 @@ def diffMessageIdTodayReport(resultPath: str, messageId: str) -> str:
if not os.path.isfile(filename):
continue
with open(filename, 'rt') as f:
diff_stats = f.read()
if messageId not in diff_stats:
diff_stats = json.loads(f.read())
if messageId not in diff_stats['sums']:
continue
if OLD_VERSION not in diff_stats['sums'][messageId]:
continue
if today not in diff_stats:
if today not in diff_stats["date"]:
continue

url = None
diff = False
firstLine = True
Expand Down
Loading