fix timeouts and pimcomp artifacts dir
Validate Operations / validate-operations (push) Has been cancelled
Validate Operations / validate-operations (push) Has been cancelled
This commit is contained in:
@@ -65,6 +65,7 @@ def _stream_output(fd, process, reporter, treat_eio_as_eof=False, stream_output=
|
||||
|
||||
|
||||
def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False, timeout_sec=None):
|
||||
effective_timeout_sec = None if timeout_sec == 0 else timeout_sec
|
||||
if reporter is None:
|
||||
if capture_output:
|
||||
completed = subprocess.run(
|
||||
@@ -73,10 +74,10 @@ def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
timeout=timeout_sec,
|
||||
timeout=effective_timeout_sec,
|
||||
)
|
||||
return completed.stdout.decode("utf-8", errors="replace")
|
||||
subprocess.run(cmd, cwd=cwd, check=True, timeout=timeout_sec)
|
||||
subprocess.run(cmd, cwd=cwd, check=True, timeout=effective_timeout_sec)
|
||||
return None
|
||||
|
||||
stream_output = bool(getattr(reporter, "verbose", False))
|
||||
@@ -86,7 +87,7 @@ def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False
|
||||
cwd=cwd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
timeout=timeout_sec,
|
||||
timeout=effective_timeout_sec,
|
||||
)
|
||||
if completed.returncode != 0:
|
||||
raise subprocess.CalledProcessError(completed.returncode, completed.args, output=completed.stdout)
|
||||
@@ -102,7 +103,7 @@ def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
assert process.stdout is not None
|
||||
output = _stream_output(process.stdout.fileno(), process, reporter, timeout_sec=timeout_sec)
|
||||
output = _stream_output(process.stdout.fileno(), process, reporter, timeout_sec=effective_timeout_sec)
|
||||
return output.decode("utf-8", errors="replace") if capture_output else None
|
||||
|
||||
try:
|
||||
@@ -115,5 +116,5 @@ def run_command_with_reporter(cmd, cwd=None, reporter=None, capture_output=False
|
||||
finally:
|
||||
os.close(slave_fd)
|
||||
|
||||
output = _stream_output(master_fd, process, reporter, treat_eio_as_eof=True, timeout_sec=timeout_sec)
|
||||
output = _stream_output(master_fd, process, reporter, treat_eio_as_eof=True, timeout_sec=effective_timeout_sec)
|
||||
return output.decode("utf-8", errors="replace") if capture_output else None
|
||||
|
||||
@@ -1521,11 +1521,11 @@ def main():
|
||||
"Reuse PIMCOMP outputs",
|
||||
copy_pimcomp_outputs,
|
||||
reused_pimcomp_dir,
|
||||
out_dir / "pimcomp",
|
||||
out_dir / "pimcomp/output",
|
||||
)
|
||||
if copied_pimcomp:
|
||||
verification_info = out_dir / "pimcomp/VerificationInfo.json"
|
||||
simulation_info = out_dir / "pimcomp/SimulationInfo.gz"
|
||||
verification_info = out_dir / "pimcomp/output/VerificationInfo.json"
|
||||
simulation_info = out_dir / "pimcomp/output/SimulationInfo.gz"
|
||||
print_step("Reuse PIMCOMP")
|
||||
print(f" Directory: {reused_pimcomp_dir}")
|
||||
else:
|
||||
|
||||
@@ -361,7 +361,7 @@ def comparison_command_for(
|
||||
if reuse_shared_pimcomp:
|
||||
reuse_pimcomp_dir = spec.shared_pimcomp_dir
|
||||
elif args.only == "raptor":
|
||||
reuse_pimcomp_dir = spec.output_dir / "pimcomp/output"
|
||||
reuse_pimcomp_dir = existing_pimcomp_dir(spec.output_dir)
|
||||
return comparison_command(
|
||||
spec.model,
|
||||
spec.output_dir,
|
||||
@@ -388,6 +388,11 @@ def pimcomp_artifact_ready(output_dir: Path) -> bool:
|
||||
) and (output_dir.parent / "comparison_report.json").is_file()
|
||||
|
||||
|
||||
def existing_pimcomp_dir(comparison_dir: Path) -> Path | None:
|
||||
output_dir = comparison_dir / "pimcomp/output"
|
||||
return output_dir if pimcomp_artifact_ready(output_dir) else None
|
||||
|
||||
|
||||
def run_comparison_jobs(
|
||||
comparison_jobs: list[tuple[str, list[str], Path | None]],
|
||||
max_workers: int,
|
||||
@@ -579,10 +584,10 @@ def main() -> int:
|
||||
required = (
|
||||
comparison_dir / "pimcomp/comparison_report.json"
|
||||
if args.only == "pimcomp"
|
||||
else comparison_dir / "pimcomp/output/SimulationInfo.gz"
|
||||
else existing_pimcomp_dir(comparison_dir)
|
||||
)
|
||||
if not required.exists():
|
||||
missing_reuse.append(str(required))
|
||||
if required is None or not required.exists():
|
||||
missing_reuse.append(str(required or comparison_dir / "pimcomp"))
|
||||
elif args.only == "raptor":
|
||||
report = comparison_dir / "pimcomp/comparison_report.json"
|
||||
if not report.exists() or json.loads(report.read_text(encoding="utf-8")).get(
|
||||
|
||||
Reference in New Issue
Block a user