launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05361
[Merge] lp:~mbp/launchpad/884997-rusage into lp:launchpad
Martin Pool has proposed merging lp:~mbp/launchpad/884997-rusage into lp:launchpad with lp:~mbp/launchpad/884092-buildd-versions as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #884997 in Launchpad itself: "buildrecipe doesn't report resource usage"
https://bugs.launchpad.net/launchpad/+bug/884997
For more details, see:
https://code.launchpad.net/~mbp/launchpad/884997-rusage/+merge/80971
This makes buildrecipe log the rusage of bzr dailydeb which will let us see how close to the edge we are wrt memory.
It also fixes some confusing code whereby the argv[0] of buildrecipe is buildrecipe.py.
I have tested this manually by calling in to this code from a python shell. I would like to write an automatic test but it's a little bit hard because this is a script not a module, and I'm concerned that renaming it will break things in the complicated deployment process. Advice on whether to try or not welcome.
--
https://code.launchpad.net/~mbp/launchpad/884997-rusage/+merge/80971
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mbp/launchpad/884997-rusage into lp:launchpad.
=== modified file 'lib/canonical/buildd/buildrecipe'
--- lib/canonical/buildd/buildrecipe 2011-11-02 01:25:32 +0000
+++ lib/canonical/buildd/buildrecipe 2011-11-02 01:25:33 +0000
@@ -13,8 +13,8 @@
from resource import RLIMIT_AS, setrlimit
import socket
from subprocess import (
+ Popen,
call,
- check_call,
)
import sys
@@ -33,6 +33,20 @@
Exception.__init__(self, 'Not running under Xen.')
+def call_report_rusage(args):
+ """Run a subprocess.
+
+ Report that it was run, and the resources used, and complain if it fails.
+
+ :return: The process wait status.
+ """
+ print 'RUN %r' % args
+ proc = Popen(args)
+ pid, status, rusage = os.wait4(proc.pid, 0)
+ print(rusage)
+ return status
+
+
class RecipeBuilder:
"""Builds a package from a recipe."""
@@ -106,7 +120,7 @@
'DEBEMAIL': self.author_email,
'DEBFULLNAME': self.author_name.encode('utf-8'),
'BZR_EMAIL': bzr_email}
- retcode = call([
+ retcode = call_report_rusage([
'bzr', 'dailydeb', '--safe', '--no-build', recipe_path,
self.tree_path, '--manifest', manifest_path,
'--append-version', '~%s1' % self.distroseries_name], env=env)
=== modified file 'lib/canonical/buildd/sourcepackagerecipe.py'
--- lib/canonical/buildd/sourcepackagerecipe.py 2010-06-30 16:07:47 +0000
+++ lib/canonical/buildd/sourcepackagerecipe.py 2011-11-02 01:25:33 +0000
@@ -86,7 +86,7 @@
recipe_path = get_chroot_path(self._buildid, 'work/recipe')
splat_file(recipe_path, self.recipe_text)
args = [
- "buildrecipe.py", self._buildid, self.author_name.encode('utf-8'),
+ "buildrecipe", self._buildid, self.author_name.encode('utf-8'),
self.author_email, self.suite, self.distroseries_name,
self.component, self.archive_purpose]
self.runSubProcess(self.build_recipe_path, args)