From patchwork Mon Sep 16 10:15:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Williams X-Patchwork-Id: 20334 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 58F9024694 for ; Mon, 16 Sep 2013 10:15:35 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id i13sf1783650qae.1 for ; Mon, 16 Sep 2013 03:15:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:to:from:subject :message-id:date:reply-to:sender:errors-to:precedence :x-original-sender:x-original-authentication-results:mailing-list :list-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=MDK47YmjcLginlRXI/BCjhuIqALfndxQJvKtWMN1UjI=; b=bjRiCDM+64g+vagbDoFipWkmLyRiBa3kY7S6mkVu/paaCbheuMwmQIzJUS0od4yyTq WSfMKDLiIW28FB5sJwv6CESlgunIulETspGwt8e5rNB3y1p/ZRrfGUYOIWLfTnAwDd/y ItlOMpIrTm1vi+ctlDBtKP8Fv9esSZpHxRsEe+8c3azwIt8U+BRszKGagHrvBaND6oa2 FNSYQDzh2KW02D2LAWZ3kKgAMycwXWVryfWLbx+SaKdS1D91M9yGoS1scFHdL3MhBZ8n MrxCKR4IzWBMMUJQ9bIuoejijcG3LTK7SZE3nkDMnAL+Cw+HpcD0RQQcvzeRjipfCTXN ywlw== X-Gm-Message-State: ALoCoQleITdm4r8+5Hg0Lhd6+9yUjKgO5d9QMHn05DDbRBWmAiVdILSZMlNQ8P+0UvNzvYI5edHr X-Received: by 10.236.56.70 with SMTP id l46mr11014245yhc.2.1379326535574; Mon, 16 Sep 2013 03:15:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.84.201 with SMTP id b9ls2151357qez.62.gmail; Mon, 16 Sep 2013 03:15:35 -0700 (PDT) X-Received: by 10.220.145.132 with SMTP id d4mr26195049vcv.9.1379326535421; Mon, 16 Sep 2013 03:15:35 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id dt10si6897071vdb.112.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 03:15:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id c14so2794541vea.15 for ; Mon, 16 Sep 2013 03:15:35 -0700 (PDT) X-Received: by 10.52.122.68 with SMTP id lq4mr22200505vdb.21.1379326535342; Mon, 16 Sep 2013 03:15:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp88166vcz; Mon, 16 Sep 2013 03:15:34 -0700 (PDT) X-Received: by 10.180.24.198 with SMTP id w6mr12824015wif.1.1379326534370; Mon, 16 Sep 2013 03:15:34 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id um9si3927645wjc.4.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Sep 2013 03:15:34 -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; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1VLVq9-0008Ma-PS for ; Mon, 16 Sep 2013 10:15:33 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id AA8E8E95E1 for ; Mon, 16 Sep 2013 10:15:33 +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: 266 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 266: Neil Williams 2013-09-13 Fix 1223264 to check for empty device_types in Message-Id: <20130916101533.14738.36587.launchpad@ackee.canonical.com> Date: Mon, 16 Sep 2013 10:15:33 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16761"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 989c55d9c66a8ae0f45c1dbd0d0562cff7b4d758 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Neil Williams (codehelp) Related merge proposals: https://code.launchpad.net/~codehelp/lava-scheduler/1223264/+merge/185473 proposed by: Neil Williams (codehelp) review: Approve - Matthew Hart (matthew-hart) ------------------------------------------------------------ revno: 266 [merge] committer: Neil Williams branch nick: lava-scheduler timestamp: Mon 2013-09-16 10:55:47 +0100 message: Neil Williams 2013-09-13 Fix 1223264 to check for empty device_types in the pending_jobs_submitted query results. modified: lava_scheduler_app/api.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_app/api.py' --- lava_scheduler_app/api.py 2013-09-02 15:14:15 +0000 +++ lava_scheduler_app/api.py 2013-09-13 11:39:18 +0000 @@ -200,10 +200,15 @@ pending_jobs_by_device = {} - jobs = TestJob.objects.filter(status=TestJob.SUBMITTED)\ + jobs_res = TestJob.objects.filter(status=TestJob.SUBMITTED)\ .values_list('requested_device_type_id')\ .annotate(pending_jobs=(Count('id'))) - pending_jobs_by_device.update(dict(jobs)) + jobs = {} + jobs_hash = dict(jobs_res) + for job in jobs_hash: + if job: + jobs[job] = jobs_hash[job] + pending_jobs_by_device.update(jobs) # Get rest of the devices and put number of pending jobs as 0. device_types = DeviceType.objects.values_list('name', flat=True)