From patchwork Wed Aug 24 10:36:10 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: 3649 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 070D323E54 for ; Wed, 24 Aug 2011 10:53:20 +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 DA866A1812A for ; Wed, 24 Aug 2011 10:53:19 +0000 (UTC) Received: by bkbzs2 with SMTP id zs2so1214900bkb.11 for ; Wed, 24 Aug 2011 03:53:19 -0700 (PDT) Received: by 10.204.146.140 with SMTP id h12mr2039273bkv.226.1314183199290; Wed, 24 Aug 2011 03:53:19 -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 n11cs9083bke; Wed, 24 Aug 2011 03:53:19 -0700 (PDT) Received: by 10.216.190.40 with SMTP id d40mr4412085wen.25.1314183198694; Wed, 24 Aug 2011 03:53:18 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id w55si2187660wec.100.2011.08.24.03.53.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Aug 2011 03:53:18 -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 1QwB5B-0003Ij-Jz for ; Wed, 24 Aug 2011 10:53:17 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id A010CE151D for ; Wed, 24 Aug 2011 10:36:10 +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: 75 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 75: * change fake-dispatcher to do the fake test result outputty thing as the very Message-Id: <20110824103610.7645.52389.launchpad@ackee.canonical.com> Date: Wed, 24 Aug 2011 10:36:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13727"; Instance="initZopeless config overlay" X-Launchpad-Hash: 7f6e497ee11055e711f265ab679d56c4672c6419 ------------------------------------------------------------ revno: 75 committer: Michael-Doyle Hudson branch nick: trunk timestamp: Wed 2011-08-24 22:33:21 +1200 message: * change fake-dispatcher to do the fake test result outputty thing as the very last thing -- this exposes a race between jobOobData completing and the process exiting. * fix the race by using the same lock the Job instance uses to serialized db operations. modified: fake-dispatcher lava_scheduler_daemon/board.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 'fake-dispatcher' --- fake-dispatcher 2011-08-17 03:09:36 +0000 +++ fake-dispatcher 2011-08-24 10:33:21 +0000 @@ -8,8 +8,3 @@ echo done echo dashboard-put-result: http://disney.com >&3 -for i in `seq 3 6`; do -sleep 2 -echo $i -done -echo ending === modified file 'lava_scheduler_daemon/board.py' --- lava_scheduler_daemon/board.py 2011-08-22 05:39:45 +0000 +++ lava_scheduler_daemon/board.py 2011-08-24 10:33:21 +0000 @@ -23,17 +23,19 @@ delimiter = '\n' - def __init__(self, source, board_name): + def __init__(self, source, board_name, _source_lock): self.source = source self.board_name = board_name + self._source_lock = _source_lock def lineReceived(self, line): if ':' not in line: self.logger.error('malformed oob data: %r' % line) return key, value = line.split(':', 1) - self.source.jobOobData( - self.board_name, key, value.lstrip()).addErrback( + self._source_lock.run( + self.source.jobOobData, self.board_name, key, + value.lstrip()).addErrback( catchall_errback(self.logger)) @@ -41,11 +43,11 @@ logger = logging.getLogger(__name__ + '.DispatcherProcessProtocol') - def __init__(self, deferred, log_file, source, board_name): + def __init__(self, deferred, log_file, source, board_name, _source_lock): self.deferred = deferred self.log_file = log_file self.source = source - self.oob_data = OOBDataProtocol(source, board_name) + self.oob_data = OOBDataProtocol(source, board_name, _source_lock) def childDataReceived(self, childFD, data): if childFD == 3: @@ -94,7 +96,7 @@ with os.fdopen(fd, 'wb') as f: json.dump(json_data, f) self._protocol = DispatcherProcessProtocol( - d, log_file, self.source, self.board_name) + d, log_file, self.source, self.board_name, self._source_lock) self.reactor.spawnProcess( self._protocol, self.dispatcher, args=[ self.dispatcher, self._json_file, '--oob-fd', '3'],