Merge lp:~jml/pkgme/instrument-run-times into lp:pkgme

Proposed by Jonathan Lange
Status: Merged
Approved by: James Westby
Approved revision: 146
Merged at revision: 146
Proposed branch: lp:~jml/pkgme/instrument-run-times
Merge into: lp:pkgme
Diff against target: 48 lines (+7/-0)
2 files modified
pkgme/api.py (+4/-0)
pkgme/run_script.py (+3/-0)
To merge this branch: bzr merge lp:~jml/pkgme/instrument-run-times
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+125153@code.launchpad.net

Commit message

Instrument script run times and file writing times

Description of the change

Occasionally, our pdf nagios check is taking too long. We don't know why.
We need more data.

Our best guesses are something in the binary backend or write contention
on the server.

The instrumentation added in this branch ought to allow us to eliminate
one or both of these guesses.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pkgme/api.py'
2--- pkgme/api.py 2012-09-03 14:19:36 +0000
3+++ pkgme/api.py 2012-09-19 10:28:22 +0000
4@@ -27,6 +27,8 @@
5 'write_packaging_info',
6 ]
7
8+import time
9+
10 from . import trace
11 from .backend import (
12 choose_backend,
13@@ -138,5 +140,7 @@
14 :param path: Path to write the packaging information to.
15 :param info: A ``ProjectInfo`` containing everything we need to package it.
16 """
17+ start_time = time.time()
18 files = default_package_file_group.get_files(info)
19 Writer().write(files, path)
20+ trace.log("Wrote packaging files in %0.3fs" % (time.time() - start_time,))
21
22=== modified file 'pkgme/run_script.py'
23--- pkgme/run_script.py 2012-08-22 13:59:26 +0000
24+++ pkgme/run_script.py 2012-09-19 10:28:22 +0000
25@@ -2,6 +2,7 @@
26 import os
27 import signal
28 import subprocess
29+import time
30
31 from pkgme.errors import PkgmeError
32 from pkgme import trace
33@@ -71,6 +72,7 @@
34 # write and raise an IOError exception rather than taking the signal."
35 #
36 # See http://www.chiark.greenend.org.uk/ucgi/~cjwatson/blosxom/2009-07-02-python-sigpipe.html
37+ start_time = time.time()
38 old_sig_pipe = signal.signal(signal.SIGPIPE, signal.SIG_DFL)
39 try:
40 try:
41@@ -103,6 +105,7 @@
42 raise ScriptFailed(cmd, retcode, output)
43 finally:
44 signal.signal(signal.SIGPIPE, old_sig_pipe)
45+ trace.log('%r finished in %0.3fs' % (cmd, time.time() - start_time))
46
47
48 def run_script(basepath, script_name, cwd, to_write=None):

Subscribers

People subscribed via source and target branches