After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 743063 - validate: launcher: Add option to run tests in parallel
validate: launcher: Add option to run tests in parallel
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-devtools
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-01-16 22:02 UTC by Ramiro Polla
Modified: 2015-02-16 16:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
validate: launcher: Separate Reporter from current Test (4.07 KB, patch)
2015-01-20 13:48 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Split test log file handling in Reporter (2.00 KB, patch)
2015-01-20 13:48 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Remove redundant check (983 bytes, patch)
2015-01-20 13:48 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Move logfile handling out of Reporter and into Test (6.47 KB, patch)
2015-01-20 13:48 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Split process_update() out of wait_process() (4.01 KB, patch)
2015-01-20 13:48 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Initialize Test start time outside of wait_process (1.43 KB, patch)
2015-01-20 13:48 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Use a Queue to test for test completion (1.99 KB, patch)
2015-01-20 13:48 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Make TestManager handle waiting for processes (3.26 KB, patch)
2015-01-20 13:49 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Support simultaneous requests in RangeHTTPServer (1.17 KB, patch)
2015-01-20 13:49 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Use test index instead of counting test numbers (2.08 KB, patch)
2015-01-20 13:49 UTC, Thibault Saunier
reviewed Details | Review
validate: launcher: Use jobs list to take track or tests running (2.90 KB, patch)
2015-01-20 13:49 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Print test number on result (1.04 KB, patch)
2015-01-20 13:49 UTC, Thibault Saunier
accepted-commit_now Details | Review
validate: launcher: Add option to run tests in parallel (3.37 KB, patch)
2015-01-20 13:49 UTC, Thibault Saunier
reviewed Details | Review
validate: launcher: Use a Queue to test for test completion (1.83 KB, patch)
2015-01-20 16:21 UTC, Ramiro Polla
accepted-commit_now Details | Review
validate: launcher: Make TestManager handle waiting for processes (3.70 KB, patch)
2015-01-20 16:21 UTC, Ramiro Polla
accepted-commit_now Details | Review
validate: launcher: Use test index instead of counting test numbers (2.06 KB, patch)
2015-01-20 16:22 UTC, Ramiro Polla
accepted-commit_now Details | Review
validate: launcher: Use jobs list to take track of tests running (2.87 KB, patch)
2015-01-20 16:22 UTC, Ramiro Polla
accepted-commit_now Details | Review
validate: launcher: Add option to run tests in parallel (2.97 KB, patch)
2015-01-20 16:22 UTC, Ramiro Polla
accepted-commit_now Details | Review
validate: launcher: Print test name in Result (942 bytes, patch)
2015-01-20 16:23 UTC, Ramiro Polla
accepted-commit_now Details | Review

Description Ramiro Polla 2015-01-16 22:02:27 UTC
Most tests use just one core or just wait idly for a long time.

Running tests in parallel speeds up the whole process, even in a single-core machine, since some tests just remain idle.

These results show a good speedup on my box by using 4 cores (I had some unrelated problem with streaming so I disabled http and hls tests):

$ gst-validate-launcher --mute -b "validate.hls.*" -b "validate.http.*" -b "ges.*" -j 1
           Total time spent: 0:26:31.695281 seconds

$ gst-validate-launcher --mute -b "validate.hls.*" -b "validate.http.*" -b "ges.*" -j 4
           Total time spent: 0:09:40.981110 seconds

Plus if you run the tests without --mute you get a nice symphony =)

The code can be found here:
http://cgit.collabora.com/git/user/ramiro/gst-devtools.git/log/?h=parallel
Comment 1 Thibault Saunier 2015-01-17 09:48:54 UTC
Thanks for that, I will have a look soon!

About the network tests not working, it is because the server is not able to handle more than one connection at a time (it is a very basic server!).

Could you have a look and also fix that?
Comment 2 Ramiro Polla 2015-01-19 13:55:00 UTC
Added support for multiple threads in the HTTP server. Updated git repo. I still disabled a few tests that take 10 minutes to reach the hard timeout. The GES tests aren't running on git HEAD either.

$ gst-validate-launcher --sync --mute -b "validate.http.transcode.*.vorbis_vp8_1_webm" -b validate.http.playback.seek_with_stop.mp3_h264_1_mp4 -b validate.http.playback.seek_with_stop.raw_h264_1_mp4

The results on a box with 4 cores were:
 -j1           Total time spent: 0:37:03.168778 seconds
 -j2           Total time spent: 0:20:21.908862 seconds
 -j4           Total time spent: 0:10:57.954698 seconds
 -j8           Total time spent: 0:06:44.182272 seconds
Comment 3 Thibault Saunier 2015-01-19 19:02:19 UTC
(In reply to comment #2)
> Added support for multiple threads in the HTTP server. Updated git repo. I
> still disabled a few tests that take 10 minutes to reach the hard timeout.

We should probably change that hard timeout to something more sensible than 10 minutes.

> The GES tests aren't running on git HEAD either.

What do you mean GES tests aren't running on master?


> $ gst-validate-launcher --sync --mute -b
> "validate.http.transcode.*.vorbis_vp8_1_webm" -b
> validate.http.playback.seek_with_stop.mp3_h264_1_mp4 -b
> validate.http.playback.seek_with_stop.raw_h264_1_mp4
> 
> The results on a box with 4 cores were:
>  -j1           Total time spent: 0:37:03.168778 seconds
>  -j2           Total time spent: 0:20:21.908862 seconds
>  -j4           Total time spent: 0:10:57.954698 seconds
>  -j8           Total time spent: 0:06:44.182272 seconds

Thanks for that, I will review it as soon as I find some time
Comment 4 Thibault Saunier 2015-01-20 13:48:27 UTC
Created attachment 294981 [details] [review]
validate: launcher: Separate Reporter from current Test

Instead of saving the current Test in Reporter for every test, use
function parameters to achieve the same goal.

Patch 2/5 to move logfile handling out of Reporter and into Test.
Comment 5 Thibault Saunier 2015-01-20 13:48:32 UTC
Created attachment 294982 [details] [review]
validate: launcher: Split test log file handling in Reporter

Patch 3/5 to move logfile handling out of Reporter and into Test.
Comment 6 Thibault Saunier 2015-01-20 13:48:37 UTC
Created attachment 294983 [details] [review]
validate: launcher: Remove redundant check

self.out is always available when _get_captured() is called.

Patch 4/5 to move logfile handling out of Reporter and into Test.
Comment 7 Thibault Saunier 2015-01-20 13:48:43 UTC
Created attachment 294984 [details] [review]
validate: launcher: Move logfile handling out of Reporter and into Test

This makes each Test handle its own logfile, allowing the Reporter to
work on multiple tests at the same time.

Patch 5/5 to move logfile handling out of Reporter and into Test.
Comment 8 Thibault Saunier 2015-01-20 13:48:47 UTC
Created attachment 294985 [details] [review]
validate: launcher: Split process_update() out of wait_process()

Patch 1/4 to make TestManager handle waiting for processes instead of
expecting each Test to do it.
Comment 9 Thibault Saunier 2015-01-20 13:48:53 UTC
Created attachment 294986 [details] [review]
validate: launcher: Initialize Test start time outside of wait_process

wait_process will be moved to TestManager, so the values used to track
process update must remain inside Test.

Patch 2/4 to make TestManager handle waiting for processes instead of
expecting each Test to do it.
Comment 10 Thibault Saunier 2015-01-20 13:48:58 UTC
Created attachment 294987 [details] [review]
validate: launcher: Use a Queue to test for test completion

TestManager will use a Queue to track progress for all tests. This
commit implements a queue inside Test to simplify the transition.

Patch 3/4 to make TestManager handle waiting for processes instead of
expecting each Test to do it.
Comment 11 Thibault Saunier 2015-01-20 13:49:03 UTC
Created attachment 294988 [details] [review]
validate: launcher: Make TestManager handle waiting for processes

Patch 4/4 to make TestManager handle waiting for processes instead of
expecting each Test to do it.
Comment 12 Thibault Saunier 2015-01-20 13:49:08 UTC
Created attachment 294989 [details] [review]
validate: launcher: Support simultaneous requests in RangeHTTPServer
Comment 13 Thibault Saunier 2015-01-20 13:49:13 UTC
Created attachment 294990 [details] [review]
validate: launcher: Use test index instead of counting test numbers

Patch 1/4 to implement parallel test execution.
Comment 14 Thibault Saunier 2015-01-20 13:49:19 UTC
Created attachment 294991 [details] [review]
validate: launcher: Use jobs list to take track or tests running

Currently the tests are still run serially.

Patch 2/4 to implement parallel test execution.
Comment 15 Thibault Saunier 2015-01-20 13:49:23 UTC
Created attachment 294992 [details] [review]
validate: launcher: Print test number on result

With parallel test execution, it will be hard to track which result
relates to which test. Therefore, the test number should be printed
along with the results as well.

Patch 3/4 to implement parallel test execution.
Comment 16 Thibault Saunier 2015-01-20 13:49:28 UTC
Created attachment 294993 [details] [review]
validate: launcher: Add option to run tests in parallel

Patch 4/4 to implement parallel test execution.
Comment 17 Thibault Saunier 2015-01-20 13:49:54 UTC
Review of attachment 294981 [details] [review]:

Looks good
Comment 18 Thibault Saunier 2015-01-20 13:51:16 UTC
Review of attachment 294982 [details] [review]:

Not sure what problem that solves, but looks OK
Comment 19 Thibault Saunier 2015-01-20 13:51:35 UTC
Review of attachment 294983 [details] [review]:

OK
Comment 20 Thibault Saunier 2015-01-20 13:53:34 UTC
Review of attachment 294984 [details] [review]:

OK
Comment 21 Thibault Saunier 2015-01-20 13:55:47 UTC
Review of attachment 294985 [details] [review]:

OK
Comment 22 Thibault Saunier 2015-01-20 14:05:09 UTC
Review of attachment 294988 [details] [review]:

Looks good

::: validate/launcher/baseclasses.py
@@ +795,3 @@
     def run_tests(self, cur_test_num, total_num_tests):
+        self.queue = Queue.Queue()
+

Would be better to put in __init__ but, no big deal
Comment 23 Thibault Saunier 2015-01-20 14:05:35 UTC
Review of attachment 294989 [details] [review]:

Impressively simple :)
Comment 24 Thibault Saunier 2015-01-20 14:13:59 UTC
Review of attachment 294993 [details] [review]:

Nicely simple :)

::: validate/launcher/main.py
@@ +430,3 @@
                            help="Redirect logs to 'stdout' or 'sdterr'.")
+    dir_group.add_argument("-j", "--jobs", dest="num_jobs",
+                           help="Number of tests to execute simultaneously")

You could put type=int instead of checking the type yourself.
Comment 25 Thibault Saunier 2015-01-20 14:14:15 UTC
Review of attachment 294992 [details] [review]:

As I said in another commit I think we should print the classname of the test too.
Comment 26 Thibault Saunier 2015-01-20 14:14:21 UTC
Review of attachment 294991 [details] [review]:

Looks good in overall

::: validate/launcher/baseclasses.py
@@ +798,3 @@
         except KeyboardInterrupt:
+            for test in self.jobs:
+                test._kill_subprocess()

It should be called kill_subprcess if it is public
Comment 27 Thibault Saunier 2015-01-20 14:14:24 UTC
Review of attachment 294990 [details] [review]:

::: validate/launcher/baseclasses.py
@@ +814,3 @@
+    def print_test_num(self, test):
+        cur_test_num = self.starting_test_num + self.tests.index(test) + 1
+        sys.stdout.write("[%d / %d] " % (cur_test_num, self.total_num_tests))

I think we should also print the test class here (would look better)
Comment 28 Thibault Saunier 2015-01-20 14:14:46 UTC
Review of attachment 294987 [details] [review]:

OK
Comment 29 Thibault Saunier 2015-01-20 14:15:10 UTC
Review of attachment 294986 [details] [review]:

OK
Comment 30 Thibault Saunier 2015-01-20 14:15:43 UTC
Review of attachment 294992 [details] [review]:

OK
Comment 31 Thibault Saunier 2015-01-20 14:16:00 UTC
Review of attachment 294991 [details] [review]:

OK
Comment 32 Thibault Saunier 2015-01-20 14:16:24 UTC
Review of attachment 294982 [details] [review]:

Not sure what problem that solves, but looks OK
Comment 33 Ramiro Polla 2015-01-20 14:49:22 UTC
Review of attachment 294982 [details] [review]:

after_test() currently has two functions: add results and close log file. This split makes it simpler to move logfile handling out of Reporter and into Test in the following patches. Adding results remains in after_test(), but the rest of the code is made specific to logfile handling.
Comment 34 Ramiro Polla 2015-01-20 16:13:42 UTC
Review of attachment 294988 [details] [review]:

::: validate/launcher/baseclasses.py
@@ +795,3 @@
     def run_tests(self, cur_test_num, total_num_tests):
+        self.queue = Queue.Queue()
+

Changed. It affected other patches, so they'll be updated as well.
Comment 35 Ramiro Polla 2015-01-20 16:14:03 UTC
Review of attachment 294990 [details] [review]:

::: validate/launcher/baseclasses.py
@@ +814,3 @@
+    def print_test_num(self, test):
+        cur_test_num = self.starting_test_num + self.tests.index(test) + 1
+        sys.stdout.write("[%d / %d] " % (cur_test_num, self.total_num_tests))

I'm adding a new patch for this (validate: launcher: Print test name in Result). It can be applied independently from this patchset.
Comment 36 Ramiro Polla 2015-01-20 16:14:11 UTC
Review of attachment 294991 [details] [review]:

::: validate/launcher/baseclasses.py
@@ +798,3 @@
         except KeyboardInterrupt:
+            for test in self.jobs:
+                test._kill_subprocess()

Fixed.
Comment 37 Ramiro Polla 2015-01-20 16:14:20 UTC
Review of attachment 294993 [details] [review]:

Thanks, that's simpler.

::: validate/launcher/main.py
@@ +430,3 @@
                            help="Redirect logs to 'stdout' or 'sdterr'.")
+    dir_group.add_argument("-j", "--jobs", dest="num_jobs",
+                           help="Number of tests to execute simultaneously")

Thanks, that's simpler.
Comment 38 Ramiro Polla 2015-01-20 16:21:15 UTC
Created attachment 295013 [details] [review]
validate: launcher: Use a Queue to test for test completion
Comment 39 Ramiro Polla 2015-01-20 16:21:44 UTC
Created attachment 295014 [details] [review]
validate: launcher: Make TestManager handle waiting for processes
Comment 40 Ramiro Polla 2015-01-20 16:22:10 UTC
Created attachment 295015 [details] [review]
validate: launcher: Use test index instead of counting test numbers
Comment 41 Ramiro Polla 2015-01-20 16:22:30 UTC
Created attachment 295016 [details] [review]
validate: launcher: Use jobs list to take track of tests running
Comment 42 Ramiro Polla 2015-01-20 16:22:49 UTC
Created attachment 295017 [details] [review]
validate: launcher: Add option to run tests in parallel
Comment 43 Ramiro Polla 2015-01-20 16:23:05 UTC
Created attachment 295018 [details] [review]
validate: launcher: Print test name in Result
Comment 44 Thibault Saunier 2015-01-20 16:36:35 UTC
Review of attachment 295018 [details] [review]:

OK
Comment 45 Thibault Saunier 2015-01-20 16:37:26 UTC
Review of attachment 295013 [details] [review]:

OK
Comment 46 Thibault Saunier 2015-01-20 16:38:26 UTC
Review of attachment 295014 [details] [review]:

OK
Comment 47 Thibault Saunier 2015-01-20 16:39:24 UTC
Review of attachment 295015 [details] [review]:

OK
Comment 48 Thibault Saunier 2015-01-20 16:39:48 UTC
Review of attachment 295016 [details] [review]:

OK
Comment 49 Thibault Saunier 2015-01-20 16:40:14 UTC
Review of attachment 295017 [details] [review]:

OK
Comment 50 Thibault Saunier 2015-02-16 16:30:54 UTC
Attachment 294987 [details] pushed as 0026c28 - validate: launcher: Use a Queue to test for test completion
Attachment 294989 [details] pushed as 9c46f5f - validate: launcher: Support simultaneous requests in RangeHTTPServer
Attachment 295013 [details] pushed as 0026c28 - validate: launcher: Use a Queue to test for test completion
Attachment 295014 [details] pushed as ef246a4 - validate: launcher: Make TestManager handle waiting for processes
Attachment 295015 [details] pushed as d9097f8 - validate: launcher: Use test index instead of counting test numbers
Attachment 295016 [details] pushed as a9a3664 - validate: launcher: Use jobs list to take track of tests running
Attachment 295017 [details] pushed as c0cefec - validate: launcher: Add option to run tests in parallel
Attachment 295018 [details] pushed as d833a51 - validate: launcher: Print test name in Result