From patchwork Thu Aug 18 02:27:13 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: 3496 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 676EF23E54 for ; Thu, 18 Aug 2011 02:27:15 +0000 (UTC) Received: from mail-ew0-f52.google.com (mail-ew0-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 42F3AA18756 for ; Thu, 18 Aug 2011 02:27:15 +0000 (UTC) Received: by ewy28 with SMTP id 28so858840ewy.11 for ; Wed, 17 Aug 2011 19:27:15 -0700 (PDT) Received: by 10.213.3.155 with SMTP id 27mr1544530ebn.18.1313634434926; Wed, 17 Aug 2011 19:27:14 -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.213.102.5 with SMTP id e5cs52601ebo; Wed, 17 Aug 2011 19:27:14 -0700 (PDT) Received: by 10.216.237.35 with SMTP id x35mr4844105weq.76.1313634433746; Wed, 17 Aug 2011 19:27:13 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id c45si4432414wed.110.2011.08.17.19.27.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Aug 2011 19:27:13 -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 1QtsK9-0000b0-7b for ; Thu, 18 Aug 2011 02:27:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 2D9D0E0304 for ; Thu, 18 Aug 2011 02:27:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-scheduler X-Launchpad-Branch: ~linaro-validation/lava-scheduler/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 65 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 65: reduce code duplication a bit Message-Id: <20110818022713.28308.16889.launchpad@ackee.canonical.com> Date: Thu, 18 Aug 2011 02:27:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13697"; Instance="initZopeless config overlay" X-Launchpad-Hash: e84c455a4fc78b947bb0dde9dbe706999f6e3efc ------------------------------------------------------------ revno: 65 committer: Michael-Doyle Hudson branch nick: trunk timestamp: Thu 2011-08-18 14:25:09 +1200 message: reduce code duplication a bit modified: lava_scheduler_daemon/board.py lava_scheduler_daemon/service.py --- lp:lava-scheduler https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk You are subscribed to branch lp:lava-scheduler. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription === modified file 'lava_scheduler_daemon/board.py' --- lava_scheduler_daemon/board.py 2011-08-18 02:19:55 +0000 +++ lava_scheduler_daemon/board.py 2011-08-18 02:25:09 +0000 @@ -10,7 +10,9 @@ def catchall_errback(logger): def eb(failure): - logger.exception(failure.value) + logger.error( + '%s: %s\n%s', failure.type.__name__, failure.value, + failure.getTraceback()) return eb === modified file 'lava_scheduler_daemon/service.py' --- lava_scheduler_daemon/service.py 2011-08-17 05:33:25 +0000 +++ lava_scheduler_daemon/service.py 2011-08-18 02:25:09 +0000 @@ -4,7 +4,7 @@ from twisted.internet import defer from twisted.internet.task import LoopingCall -from lava_scheduler_daemon.board import Board +from lava_scheduler_daemon.board import Board, catchall_errback class BoardSet(Service): @@ -21,12 +21,8 @@ def _updateBoards(self): self.logger.debug("Refreshing board list") - def _eb(failure): - self.logger.error( - '%s: %s\n%s', failure.type.__name__, failure.value, - failure.getTraceback()) return self.source.getBoardList().addCallback( - self._cbUpdateBoards).addErrback(_eb) + self._cbUpdateBoards).addErrback(catchall_errback(self.logger)) def _cbUpdateBoards(self, board_names): if set(board_names) == set(self.boards):