From patchwork Mon Jan 16 23:28:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 6244 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 03F7223E0E for ; Mon, 16 Jan 2012 23:28:17 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id E2B98A18158 for ; Mon, 16 Jan 2012 23:28:16 +0000 (UTC) Received: by bkbzt4 with SMTP id zt4so1112557bkb.11 for ; Mon, 16 Jan 2012 15:28:16 -0800 (PST) Received: by 10.205.26.67 with SMTP id rl3mr5839729bkb.45.1326756495993; Mon, 16 Jan 2012 15:28:15 -0800 (PST) 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.205.82.144 with SMTP id ac16cs103699bkc; Mon, 16 Jan 2012 15:28:15 -0800 (PST) Received: by 10.181.11.163 with SMTP id ej3mr23839281wid.4.1326756494708; Mon, 16 Jan 2012 15:28:14 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id m48si11119344weq.122.2012.01.16.15.28.14 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jan 2012 15:28:14 -0800 (PST) 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 1RmvyI-0003Tu-Bb for ; Mon, 16 Jan 2012 23:28:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 49098E0302 for ; Mon, 16 Jan 2012 23:28:14 +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: 112 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 112: make the device tagging code work with postgres Message-Id: <20120116232814.11624.44529.launchpad@ackee.canonical.com> Date: Mon, 16 Jan 2012 23:28:14 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14664"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 7b7f29a5d74161e38fc5e8a42d29a9c4f187321e Merge authors: Michael Hudson-Doyle (mwhudson) ------------------------------------------------------------ revno: 112 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Tue 2012-01-17 12:26:44 +1300 message: make the device tagging code work with postgres modified: lava_scheduler_daemon/dbjobsource.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/dbjobsource.py' --- lava_scheduler_daemon/dbjobsource.py 2011-12-15 03:06:49 +0000 +++ lava_scheduler_daemon/dbjobsource.py 2012-01-16 23:13:54 +0000 @@ -89,15 +89,17 @@ jobs_for_device = jobs_for_device.extra( select={ 'is_targeted': 'requested_device_id is not NULL', - 'missing_tags': ''' - select count(*) from lava_scheduler_app_testjob_tags - where testjob_id = lava_scheduler_app_testjob.id - and tag_id not in (select tag_id - from lava_scheduler_app_device_tags - where device_id = '%s') - ''' % device.hostname, }, - where=['missing_tags = 0'], + where=[ + # In human language, this is saying "where the number of + # tags that are on the job but not on the device is 0" + '''(select count(*) from lava_scheduler_app_testjob_tags + where testjob_id = lava_scheduler_app_testjob.id + and tag_id not in (select tag_id + from lava_scheduler_app_device_tags + where device_id = '%s')) = 0''' + % device.hostname, + ], order_by=['-is_targeted', 'submit_time']) jobs = jobs_for_device[:1] if jobs: