From patchwork Mon Aug 22 21:17:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 3608 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DB17D23F27 for ; Mon, 22 Aug 2011 21:17:17 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id BEC8AA1867E for ; Mon, 22 Aug 2011 21:17:17 +0000 (UTC) Received: by bkbzs2 with SMTP id zs2so6279307bkb.11 for ; Mon, 22 Aug 2011 14:17:17 -0700 (PDT) Received: by 10.204.152.148 with SMTP id g20mr1134356bkw.382.1314047836172; Mon, 22 Aug 2011 14:17:16 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.41.75 with SMTP id n11cs187035bke; Mon, 22 Aug 2011 14:17:15 -0700 (PDT) Received: by 10.227.55.67 with SMTP id t3mr33880wbg.90.1314047834721; Mon, 22 Aug 2011 14:17:14 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id fe2si2039181wbb.9.2011.08.22.14.17.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Aug 2011 14:17:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Qvbrt-0006fL-2u for ; Mon, 22 Aug 2011 21:17:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id E9D87E0618 for ; Mon, 22 Aug 2011 21:17:12 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 92 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 92: print out the URL of the bundle submitted on a specific fd (default: stderr) Message-Id: <20110822211712.15619.24028.launchpad@ackee.canonical.com> Date: Mon, 22 Aug 2011 21:17:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13714"; Instance="initZopeless config overlay" X-Launchpad-Hash: 925307b5c437544e2d62703866f5f8480d68e98a Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/output-result-sha1/+merge/71640 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Zygmunt Krynicki (zkrynicki) review: Needs Fixing - Spring Zhang (qzhang) ------------------------------------------------------------ revno: 92 [merge] committer: Michael-Doyle Hudson branch nick: trunk timestamp: Tue 2011-08-23 09:15:01 +1200 message: print out the URL of the bundle submitted on a specific fd (default: stderr) modified: lava-dispatch lava_dispatcher/__init__.py lava_dispatcher/actions/launch_control.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava-dispatch' --- lava-dispatch 2011-06-27 04:55:08 +0000 +++ lava-dispatch 2011-08-17 00:52:46 +0000 @@ -19,24 +19,31 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, see . +import optparse +import os import sys from lava_dispatcher import LavaTestJob -def usage(status): - print >> sys.stderr, "Usage:\n lava-dispatch " - sys.exit(status) - -if len(sys.argv) != 2: - usage(1) - -if sys.argv[1] == "--help": - usage(0) - -with open(sys.argv[1]) as fd: +parser = optparse.OptionParser('%prog: lava-dispatch ') +parser.add_option( + "--oob-fd", default=None, type=int, help="Write OOB data to this fd.") + +(options, args) = parser.parse_args() + +if len(args) != 1: + parser.print_help() + sys.exit(1) + +if options.oob_fd: + oob_file = os.fdopen(options.oob_fd, 'w') +else: + oob_file = sys.stderr + +with open(args[0]) as fd: jobdata = fd.read() -job = LavaTestJob(jobdata) +job = LavaTestJob(jobdata, oob_file) #FIXME Return status job.run() === modified file 'lava_dispatcher/__init__.py' --- lava_dispatcher/__init__.py 2011-08-20 02:17:57 +0000 +++ lava_dispatcher/__init__.py 2011-08-22 21:13:22 +0000 @@ -33,10 +33,10 @@ __version__ = "0.2.0" class LavaTestJob(object): - def __init__(self, job_json): + def __init__(self, job_json, oob_file): self.job_status = 'pass' self.load_job_data(job_json) - self.context = LavaContext(self.target, self.image_type) + self.context = LavaContext(self.target, self.image_type, oob_file) def load_job_data(self, job_json): self.job_data = json.loads(job_json) @@ -104,12 +104,13 @@ class LavaContext(object): - def __init__(self, target, image_type): + def __init__(self, target, image_type, oob_file): if image_type != "android": self._client = LavaClient(target) else: self._client = LavaAndroidClient(target) self.test_data = LavaTestData() + self.oob_file = oob_file @property def client(self): === modified file 'lava_dispatcher/actions/launch_control.py' --- lava_dispatcher/actions/launch_control.py 2011-08-16 00:15:08 +0000 +++ lava_dispatcher/actions/launch_control.py 2011-08-17 10:36:29 +0000 @@ -47,7 +47,8 @@ content = f.read() f.close() try: - srv.put(content, bundle, stream) + print >> self.context.oob_file, 'dashboard-put-result:', \ + srv.put_ex(content, bundle, stream) except xmlrpclib.Fault, err: print "xmlrpclib.Fault occurred" print "Fault code: %d" % err.faultCode @@ -131,7 +132,8 @@ attributes.update(self.context.test_data.get_metadata()) test_run['attributes'] = attributes json_bundle = json.dumps(main_bundle) - srv.put(json_bundle, 'lava-dispatcher.bundle', stream) + print >> self.context.oob_file, 'dashboard-put-result:', \ + srv.put_ex(json_bundle, 'lava-dispatcher.bundle', stream) def combine_bundles(self): if not self.all_bundles: