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