[bitbake-devel,3/4] cooker: Allow faster exitting from parser threads

Submitted by Richard Purdie on Jan. 7, 2019, 3:55 p.m. | Patch ID: 157606

Details

Message ID 20190107155536.6062-3-richard.purdie@linuxfoundation.org
State Master Next
Commit 0e7a373def9d348ae2774b78bf3bd18f3d2b1912
Headers show

Commit Message

Richard Purdie Jan. 7, 2019, 3:55 p.m.
We don't push "None" values onto the parser queue so currently idle parsing
threads loop every 0.25s and idle. They may as well exit out of their work
is done.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/cooker.py | 3 ---
 1 file changed, 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index d1d2868d6f..9b2a0920f9 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1943,9 +1943,6 @@  class Parser(multiprocessing.Process):
                 try:
                     job = self.jobs.get(timeout=0.25)
                 except queue.Empty:
-                    continue
-
-                if job is None:
                     break
                 result = self.parse(*job)
 

Comments

Christopher Larson Jan. 7, 2019, 4:02 p.m.
Empty is raised when it times out, not just when it’s actually empty,
though.

On Mon, Jan 7, 2019 at 8:55 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> We don't push "None" values onto the parser queue so currently idle parsing
> threads loop every 0.25s and idle. They may as well exit out of their work
> is done.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/cooker.py | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
> index d1d2868d6f..9b2a0920f9 100644
> --- a/lib/bb/cooker.py
> +++ b/lib/bb/cooker.py
> @@ -1943,9 +1943,6 @@ class Parser(multiprocessing.Process):
>                  try:
>                      job = self.jobs.get(timeout=0.25)
>                  except queue.Empty:
> -                    continue
> -
> -                if job is None:
>                      break
>                  result = self.parse(*job)
>
> --
> 2.19.1
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>
Richard Purdie Jan. 7, 2019, 5:25 p.m.
On Mon, 2019-01-07 at 09:02 -0700, Christopher Larson wrote:
> Empty is raised when it times out, not just when it’s actually empty,
> though.

Good point, thanks. I was about to rework it but my next patch removes
it entirely so I guess I can just drop this intermediate one...

Cheers,

Richard