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

run_all.py: print output on sequential run failure #2079

Merged
merged 1 commit into from
May 10, 2023
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
34 changes: 20 additions & 14 deletions scripts/run_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,42 @@
from typing import Any, List, Optional, Tuple, Type


def start_process(args: List[str], cwd: str, wait: bool) -> Any:
process = subprocess.Popen(
args,
cwd=cwd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
if wait:
returncode = process.wait()
if returncode != 0:
print(process.communicate()[0].decode("utf-8").rstrip())
print(f"process exited with error code {returncode}")
exit(returncode)
return process


def run_py_example(path: str, viewer_port: Optional[int] = None, wait: bool = True, save: Optional[str] = None) -> Any:
args = ["python3", "main.py", "--num-frames=30", "--steps=200"]
if save is not None:
args += [f"--save={save}"]
if viewer_port is not None:
args += ["--connect", f"--addr=127.0.0.1:{viewer_port}"]

process = subprocess.Popen(
return start_process(
args,
cwd=path,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
wait=wait,
)
if wait:
returncode = process.wait()
assert returncode == 0, f"process exited with error code {returncode}"
return process


def run_saved_example(path: str, wait: bool = True) -> Any:
process = subprocess.Popen(
return start_process(
["cargo", "run", "-p", "rerun", "--all-features", "--", "out.rrd"],
cwd=path,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
wait=wait,
)
if wait:
returncode = process.wait()
assert returncode == 0, f"process exited with error code {returncode}"
return process


def get_free_port() -> int:
Expand Down