From patchwork Wed Jun 27 09:10:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Spring Zhang X-Patchwork-Id: 9646 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 A7ED423E01 for ; Wed, 27 Jun 2012 09:10:19 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 55365A1825F for ; Wed, 27 Jun 2012 09:10:19 +0000 (UTC) Received: by ggnf1 with SMTP id f1so764993ggn.11 for ; Wed, 27 Jun 2012 02:10:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=xiJ/xBtX5/44w23uLgemWiTVd1rRE5Y3NyWAv1PdH4A=; b=lfbggNIOyRUNIsc5GwcVmkhrJEJMYoq2603WVC3+CH5q8D5q9MiZn+WOX3C7iot+ks N9U8AR/sIDhLDaBt0toUDzY3XuoMesQyBjwAIhhwSPz+hSD3+Wrm6I6zwYFfQVvucYHc Rt4StcULpOBtSWtS3bRXstz4uBcl9ldwd8mEfhkRq6jBZ7Xajvfn3KARbVX6ohcA8IEw QixqcuhDCoTIhyjy+Pf0ve8gFBG8Mn733Cut5JR+qRistZxgUA5k2QkOg6EqYI0dsN1l 7MyVIIji+uw4DB7x1QVJLUaHHoAzdQ7IrLWq0GDHLMWpo4TzlUBnZ7YGS01ic4pAOhQZ czYg== Received: by 10.50.40.193 with SMTP id z1mr818259igk.0.1340788218513; Wed, 27 Jun 2012 02:10:18 -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.231.24.148 with SMTP id v20csp6247ibb; Wed, 27 Jun 2012 02:10:17 -0700 (PDT) Received: by 10.216.228.224 with SMTP id f74mr10017890weq.217.1340788217108; Wed, 27 Jun 2012 02:10:17 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id 50si22712593wet.43.2012.06.27.02.10.16 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jun 2012 02:10:17 -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 1SjoGN-0000po-Rc for ; Wed, 27 Jun 2012 09:10:15 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id BCD50E01BB for ; Wed, 27 Jun 2012 09:10:15 +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: 191 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 191: Correct queued job query condition and a display name Message-Id: <20120627091015.7683.81125.launchpad@ackee.canonical.com> Date: Wed, 27 Jun 2012 09:10:15 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15482"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 63e9a8d01f24048341057701cdefc4d39ac87938 X-Gm-Message-State: ALoCoQmiNoYj+gajBTwELmjfH9tLaqHh4uB7UwuQ9drxGOWNlHbDOAda75Ui+2c4AX6QzDAOHOdq Merge authors: Spring Zhang (qzhang) Related merge proposals: https://code.launchpad.net/~qzhang/lava-scheduler/name-mistake/+merge/111988 proposed by: Spring Zhang (qzhang) review: Approve - Spring Zhang (qzhang) ------------------------------------------------------------ revno: 191 [merge] committer: Spring Zhang branch nick: lava-scheduler timestamp: Wed 2012-06-27 17:09:09 +0800 message: Correct queued job query condition and a display name modified: lava_scheduler_app/views.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/views.py' --- lava_scheduler_app/views.py 2012-06-16 04:08:20 +0000 +++ lava_scheduler_app/views.py 2012-06-26 01:49:31 +0000 @@ -26,6 +26,7 @@ from django.utils.html import escape from django.utils.safestring import mark_safe from django.db import models +from django.db.models import Q from django_tables2 import Attrs, Column @@ -296,7 +297,7 @@ The value is defined when table instance is created in device_type_detail() """ - def render_name(self, record): + def render_Duration(self, record): matrix = {-24:"24hours", -24*7:"Week", -24*7*30:"Month"} return matrix[record] @@ -315,7 +316,7 @@ TestJob.CANCELED, TestJob.CANCELING]).count() return num - name = Column() + Duration = Column() Complete = Column() Failed = Column() @@ -343,11 +344,10 @@ 'running_jobs_num': TestJob.objects.filter( actual_device__in=Device.objects.filter(device_type=dt), status=TestJob.RUNNING).count(), - # Fix me: doesn't count actual_device not set but requested - # device type jobs. 'queued_jobs_num': TestJob.objects.filter( - actual_device__in=Device.objects.filter(device_type=dt), - status=TestJob.SUBMITTED).count(), + Q(status=TestJob.SUBMITTED), Q(requested_device_type=dt) + | Q(requested_device__in=Device.objects.filter(device_type=dt)) + ).count(), # data return 1 day, 1 week, 1 month offset 'health_job_summary_table': HealthJobSummaryTable( 'device_type', params=(dt,), data=[-24, -24*7, -24*7*30]),