Skip to content
Snippets Groups Projects
Commit 8d6eee5e authored by Boris Feld's avatar Boris Feld
Browse files

Convert launch.sh into a Python script

The Python script will offer more flexibility to parse CLI arguments
parent 41c2aa05
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import argparse
import os
import subprocess
import sys
def shell_exec(command, env=None):
# Simulate bash script printing the commands it runs
print("+ %s" % command)
process = subprocess.Popen(command, shell=False, env=env)
retcode = process.wait()
if retcode:
raise subprocess.CalledProcessError(retcode, command)
def main(args):
parser = argparse.ArgumentParser()
parser.add_argument(
"target", nargs="?", help="the changesets to run benchmarks against"
)
args, unknown = parser.parse_known_args(args)
# Process target
if args.target is None:
target = "1.9:: and tagged()"
else:
target = args.target
# Prepare all files
shell_exec(["./run-scripts/before-check.sh"])
# ASV RUN
run_command = [
"time",
"taskset",
"-c",
"2,3",
"asv",
"run",
"--verbose",
"--show-stderr",
"--skip-existing-successful",
target,
]
run_command.extend(unknown)
env = os.environ.copy()
env["HGRCPATH"] = ""
shell_exec(run_command, env=env)
# ASV Publish
shell_exec(["asv", "publish", "--no-pull"])
if __name__ == "__main__":
main(sys.argv[1:])
#!/bin/bash
set -euox pipefail
./run-scripts/before-check.sh
target="${1-1.9:: and tagged()}"
if [ "$#" -ge 1 ]; then
shift
fi
# Launch asv
time HGRCPATH= taskset -c 2,3 asv run --verbose --show-stderr --skip-existing-successful "${target}" "$@"
# Publish results
asv publish --no-pull
echo "DONE"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment