Skip to content

Commit

Permalink
flush
Browse files Browse the repository at this point in the history
  • Loading branch information
graebm committed Oct 9, 2023
1 parent e516ede commit 1b01d35
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion runners/s3-benchrunner-c/scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


def run(cmd_args: list[str]):
print(f'> {subprocess.list2cmdline(cmd_args)}')
print(f'> {subprocess.list2cmdline(cmd_args)}', flush=True)
subprocess.run(cmd_args, check=True)


Expand Down
2 changes: 1 addition & 1 deletion runners/s3-benchrunner-crt-java/scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def run(cmd_args: list[str]):
print(f'> {subprocess.list2cmdline(cmd_args)}')
print(f'> {subprocess.list2cmdline(cmd_args)}', flush=True)
subprocess.run(cmd_args, check=True)


Expand Down
2 changes: 1 addition & 1 deletion runners/s3-benchrunner-crt-java/scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def run(cmd_args: list[str]):
print(f'> {subprocess.list2cmdline(cmd_args)}')
print(f'> {subprocess.list2cmdline(cmd_args)}', flush=True)
if subprocess.run(cmd_args).returncode != 0:
exit('FAILED')

Expand Down
2 changes: 1 addition & 1 deletion runners/s3-benchrunner-python/scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def run(cmd_args: list[str]):
print(f'> {subprocess.list2cmdline(cmd_args)}')
print(f'> {subprocess.list2cmdline(cmd_args)}', flush=True)
subprocess.run(cmd_args, check=True)


Expand Down
4 changes: 2 additions & 2 deletions scripts/fetch-git-repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@


def run(cmd_args: list[str]):
print(f'> {subprocess.list2cmdline(cmd_args)}')
print(f'> {subprocess.list2cmdline(cmd_args)}', flush=True)
subprocess.run(cmd_args, check=True)


def try_run(cmd_args: list[str]) -> bool:
print(f'> {subprocess.list2cmdline(cmd_args)}')
print(f'> {subprocess.list2cmdline(cmd_args)}', flush=True)
result = subprocess.run(cmd_args)
return result.returncode == 0

Expand Down
2 changes: 1 addition & 1 deletion scripts/install-tools-AL2023.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def run(cmd_args: list[str]):
print(f'> {subprocess.list2cmdline(cmd_args)}')
print(f'> {subprocess.list2cmdline(cmd_args)}', flush=True)
subprocess.run(cmd_args, check=True)


Expand Down
2 changes: 1 addition & 1 deletion scripts/lint-python.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def run(cmd_args: list[str]):
print(f'> {subprocess.list2cmdline(cmd_args)}')
print(f'> {subprocess.list2cmdline(cmd_args)}', flush=True)
result = subprocess.run(cmd_args)
if result.returncode != 0:
exit('FAILED')
Expand Down
21 changes: 16 additions & 5 deletions scripts/run-benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
'--benchmark', action='append',
help='Path to specific benchmark JSON file. ' +
'May be specified multiple times. ' +
'By default, everything in benchmarks/ is run.')
'If omitted, everything in benchmarks/ is run.')
parser.add_argument(
'--files-dir',
help='Launch runner in this directory. ' +
'Files are uploaded from and downloaded to here' +
'If omitted, CWD is used.')

args = parser.parse_args()

if args.benchmark:
Expand All @@ -40,18 +46,23 @@
if not benchmark.exists():
exit(f'benchmark not found: {str(benchmark)}')

files_dir = args.files_dir if args.files_dir else str(Path.cwd())

# split using shell-like syntax,
# in case runner-cmd has weird stuff like quotes, spaces, etc
cmd = shlex.split(args.runner_cmd)

cmd += [str(benchmark), args.bucket, args.region, str(args.throughput)]
print(f'> {subprocess.list2cmdline(cmd)}')
run = subprocess.run(cmd, text=True)
print(f'> {subprocess.list2cmdline(cmd)}', flush=True)
run = subprocess.run(cmd, text=True, cwd=files_dir)

# if runner skipped the benchmark, keep going
if run.returncode == 123:
continue

# TODO: keep going or not?
# if runner failed and we're only running 1 benchmark, exit with failure
# but if we're running multiple benchmarks, keep going
if run.returncode != 0:
exit('benchmark failed')
print('benchmark failed')
if len(benchmarks) == 1:
exit(1)

0 comments on commit 1b01d35

Please sign in to comment.