Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Patrick Ohly <patrick.ohly@intel.com>,
	bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH 2/4] runqueue.py: monitor disk space at regular time intervals
Date: Mon, 28 Nov 2016 15:58:50 +0000	[thread overview]
Message-ID: <1480348730.28508.185.camel@linuxfoundation.org> (raw)
In-Reply-To: <4a82fef918264b2e74022e8ed95cb198f44300c7.1480345719.git.patrick.ohly@intel.com>

On Mon, 2016-11-28 at 16:15 +0100, Patrick Ohly wrote:
> Hooking the disk monitor into the regular heatbeat event instead
> of the runqueue solves two problems:
> 
> - When there is just one long running task which fills up the disk,
>   the previous approach did not notice that until after the
> completion
>   of the task because _execute_runqueue() only gets called on task
>   state changes. As a result, aborting a build did not work in this
>   case.
> 
> - When there are many short-lived tasks, disk space was getting
>   checked very frequently. When the storage that is getting checked
>   is on an NFS server, that can lead to noticable traffic to the
>   server.
> 
> Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
> ---
>  lib/bb/runqueue.py | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
> index 84b2685..3772e2e 100644
> --- a/lib/bb/runqueue.py
> +++ b/lib/bb/runqueue.py
> @@ -984,7 +984,12 @@ class RunQueue:
>          self.state = runQueuePrepare
>  
>          # For disk space monitor
> +        # Invoked at regular time intervals via the bitbake
> heartbeat event
> +        # while the build is running.
>          self.dm = monitordisk.diskMonitor(cfgData)
> +        bb.event.register('_bb_diskmonitor',
> +                          lambda x: self.dm.check(self) if
> self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp]
> else False,
> +                          ('bb.event.HeartbeatEvent',))
>  
>          self.rqexe = None
>          self.worker = {}
> @@ -1208,9 +1213,6 @@ class RunQueue:
>                  self.rqdata.init_progress_reporter.next_stage()
>                  self.rqexe = RunQueueExecuteScenequeue(self)
>  
> -        if self.state in [runQueueSceneRun, runQueueRunning,
> runQueueCleanUp]:
> -            self.dm.check(self)
> -
>          if self.state is runQueueSceneRun:
>              retval = self.rqexe.execute()

Don't we have to unregister this at some point too? Cooker can persist
across multiple builds (although its not the default).

Cheers,

Richard


  reply	other threads:[~2016-11-28 15:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-28 15:15 [PATCH 0/4] system statistics sampling Patrick Ohly
2016-11-28 15:15 ` [PATCH 1/4] cooker process: fire heartbeat event at regular time intervals Patrick Ohly
2016-11-28 15:15 ` [PATCH 2/4] runqueue.py: monitor disk space " Patrick Ohly
2016-11-28 15:58   ` Richard Purdie [this message]
2016-11-28 16:30     ` Patrick Ohly
2016-11-28 15:15 ` [PATCH 3/4] monitordisk.py: minor code and comment cleanup Patrick Ohly
2016-11-28 15:15 ` [PATCH 4/4] monitordisk: add event Patrick Ohly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480348730.28508.185.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=patrick.ohly@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox