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

Add support for BISECT task in scheduler.py

parent 8ce5b7ec
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
#
# Script used on the main performance benchmark machine to run tests.
set -eox pipefail
ROOT=`dirname $0`
# source "${ROOT}"/../virtualenv/bin/activate
rm -rf "${ROOT}"/env/
./run-scripts/before-check.sh
time HGRCPATH= taskset -c 2,3 asv find --save_results $@
# Publish results
asv publish --no-pull
netlify deploy
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
RUN_SCRIPT = os.environ.get("SCHEDULER_TEST_RUN_SCRIPT", DEFAULT_RUN_SCRIPT) RUN_SCRIPT = os.environ.get("SCHEDULER_TEST_RUN_SCRIPT", DEFAULT_RUN_SCRIPT)
DEFAULT_BISECT_SCRIPT = abspath(join(dirname(__file__), "main-bisect.sh"))
BISECT_SCRIPT = os.environ.get("SCHEDULER_TEST_BISECT_SCRIPT", DEFAULT_BISECT_SCRIPT)
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
LOG_FORMAT = "[%(asctime)s] %(message)s" LOG_FORMAT = "[%(asctime)s] %(message)s"
...@@ -53,6 +56,19 @@ ...@@ -53,6 +56,19 @@
print("\n" + msg % (task, e.returncode)) print("\n" + msg % (task, e.returncode))
# XXX find a way to report an error without removing a task # XXX find a way to report an error without removing a task
def bisect(task):
splitted = shlex.split(task)
args = [BISECT_SCRIPT] + splitted
try:
print("Bisecting %r" % args)
subprocess.check_call(args)
except subprocess.CalledProcessError as e:
msg = "Task %r failed with error code %r"
LOGGER.error(msg, task, e.returncode)
print("\n" + msg % (task, e.returncode))
# XXX find a way to report an error without removing a task
def remove_task(task, task_file_path): def remove_task(task, task_file_path):
""" Remove the first line of the scheduling TASK if it match passed task """ Remove the first line of the scheduling TASK if it match passed task
...@@ -94,6 +110,8 @@ ...@@ -94,6 +110,8 @@
try: try:
if task_type == "RUN": if task_type == "RUN":
run(task_arguments) run(task_arguments)
elif task_type == "BISECT":
bisect(task_arguments)
elif task_type == "EXIT": elif task_type == "EXIT":
return return
else: else:
......
#!/bin/bash
set -eo pipefail
echo "Bisecting test script $@"
exit 0
#!/bin/bash #!/bin/bash
set -eo pipefail set -eo pipefail
echo "Running test script $@"
exit 0 exit 0
Test the scheduler Test the scheduler
$ export SCHEDULER_TEST_RUN_SCRIPT=$TESTDIR/scheduler-test-script-success $ export SCHEDULER_TEST_RUN_SCRIPT=$TESTDIR/scripts/scheduler-test-script-success
$ export SCHEDULER_TEST_BISECT_SCRIPT=$TESTDIR/scripts/scheduler-test-bisect-script-success
$ cat << EOF >> TASKS $ cat << EOF >> TASKS
> RUN tip > RUN tip
...@@ -8,6 +9,7 @@ ...@@ -8,6 +9,7 @@
> EOF > EOF
$ python $TESTDIR/../scheduler.py TASKS $ python $TESTDIR/../scheduler.py TASKS
Running test script tip
================================================================================ ================================================================================
Got task 'RUN' 'tip' Got task 'RUN' 'tip'
RUNNING ['*/scheduler-test-script-success', 'tip'] (glob) RUNNING ['*/scheduler-test-script-success', 'tip'] (glob)
...@@ -40,6 +42,7 @@ ...@@ -40,6 +42,7 @@
> EOF > EOF
$ python $TESTDIR/../scheduler.py --log LOG TASKS $ python $TESTDIR/../scheduler.py --log LOG TASKS
Running test script tip
================================================================================ ================================================================================
Got task 'RUN' 'tip' Got task 'RUN' 'tip'
RUNNING ['*/scheduler-test-script-success', 'tip'] (glob) RUNNING ['*/scheduler-test-script-success', 'tip'] (glob)
...@@ -72,5 +75,6 @@ ...@@ -72,5 +75,6 @@
> EOF > EOF
$ python $TESTDIR/../scheduler.py TASKS $ python $TESTDIR/../scheduler.py TASKS
Bisecting test script tip..tip~2 track_startup
================================================================================ ================================================================================
Got task 'BISECT' 'tip..tip~2 track_startup' Got task 'BISECT' 'tip..tip~2 track_startup'
...@@ -75,6 +79,6 @@ ...@@ -75,6 +79,6 @@
================================================================================ ================================================================================
Got task 'BISECT' 'tip..tip~2 track_startup' Got task 'BISECT' 'tip..tip~2 track_startup'
Unknown task BISECT Bisecting ['*/scripts/scheduler-test-bisect-script-success', 'tip..tip~2', 'track_startup'] (glob)
......
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