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

CI: wait and retry for diffile to exist #301

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
19 changes: 18 additions & 1 deletion utils/run_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ def parse_result(output: str) -> tuple[float, int, int]:
return (float(m[0]), int(m[1]), int(m[3]))


def _check_file_exists_and_retry(file_path, retries=60):
for _ in range(retries):
logger.info("Checking diffile exists")
if path.exists(file_path):
logger.info("Found diffile")
return True
time.sleep(5)
return False


def run_gams_gdxdiff(
benchmark: Any,
times_folder: str,
Expand Down Expand Up @@ -129,9 +139,16 @@ def run_gams_gdxdiff(
logger.info(res.stdout)
logger.info(res.stderr if res.stderr is not None else "")
if res.returncode != 0:
diffile = path.join(out_folder, "diffile.gdx")
if not _check_file_exists_and_retry(diffile):
logger.info(res.stdout)
logger.info(res.stderr if res.stderr is not None else "")
logger.error(
f"GAMS gdxdiff failed on {benchmark['name']}: diffile.gdx not found"
)
# Report the number of lines in the gdxdump of the difffile
res = subprocess.run(
["gdxdump", path.join(out_folder, "diffile.gdx")],
["gdxdump", diffile],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
Expand Down
Loading