-
Notifications
You must be signed in to change notification settings - Fork 67
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
Wait for GHA eval results instead of falling back to local evaluation #451
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import subprocess | ||
import sys | ||
import tempfile | ||
import time | ||
from dataclasses import dataclass, field | ||
from enum import Enum | ||
from pathlib import Path | ||
|
@@ -296,14 +297,24 @@ def build_pr(self, pr_number: int) -> dict[System, list[Attr]]: | |
pr = self.github_client.pull_request(pr_number) | ||
|
||
packages_per_system: dict[System, set[str]] | None = None | ||
if self.use_github_eval and all(system in PLATFORMS for system in self.systems): | ||
# Attempt to fetch the GitHub actions evaluation result | ||
print("-> Attempting to fetch eval results from GitHub actions") | ||
packages_per_system = self.github_client.get_github_action_eval_result(pr) | ||
|
||
if packages_per_system is not None: | ||
print("-> Successfully fetched rebuilds: no local evaluation needed") | ||
if self.use_github_eval: | ||
assert all(system in PLATFORMS for system in self.systems) | ||
print("-> Fetching eval results from GitHub actions") | ||
|
||
packages_per_system = self.github_client.get_github_action_eval_result(pr) | ||
if packages_per_system is None: | ||
timeout: int = 10 | ||
print(f"...Results are not (yet) available. Retrying in {timeout}s") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe just print this message just once and just add a dot add the end each time it's not finished to indicate progress. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea ! Done. |
||
while packages_per_system is None: | ||
print(".", end="") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't work. Nothing is printed. If I remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's line buffered. Try flushing sys.stdout.flush() |
||
sys.stdout.flush() | ||
time.sleep(timeout) | ||
packages_per_system = ( | ||
self.github_client.get_github_action_eval_result(pr) | ||
) | ||
print() | ||
|
||
print("-> Successfully fetched rebuilds: no local evaluation needed") | ||
else: | ||
packages_per_system = None | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this also returns None if the evaluation failed. However in this case we shouldn't wait as we would wait forever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we crash in this case then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be another reason why we would want to wait 'within' the github function. I.e. we would wait only in the case where we know that the results are currently computed.