From nobody Tue May 13 09:12:50 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 206.53.239.180 is neither permitted nor denied by domain of freelists.org) client-ip=206.53.239.180; envelope-from=patchew-devel-bounce@freelists.org; helo=turing.freelists.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=none (zoho.com: 206.53.239.180 is neither permitted nor denied by domain of freelists.org) smtp.mailfrom=patchew-devel-bounce@freelists.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from turing.freelists.org (turing.freelists.org [206.53.239.180]) by mx.zohomail.com with SMTPS id 1520412394181326.8177906492451; Wed, 7 Mar 2018 00:46:34 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 93518262E2; Wed, 7 Mar 2018 03:46:26 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nbjeGsoTsYSq; Wed, 7 Mar 2018 03:46:26 -0500 (EST) Received: from turing.freelists.org (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 3840E260D3; Wed, 7 Mar 2018 03:46:26 -0500 (EST) Received: with ECARTIS (v1.0.0; list patchew-devel); Wed, 07 Mar 2018 03:46:26 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 0BA1F262E2 for ; Wed, 7 Mar 2018 03:46:26 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 58sjCYTWPi59 for ; Wed, 7 Mar 2018 03:46:25 -0500 (EST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id DD43B260D3 for ; Wed, 7 Mar 2018 03:46:25 -0500 (EST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93EDE40363BE for ; Wed, 7 Mar 2018 08:46:25 +0000 (UTC) Received: from lemon.usersys.redhat.com (ovpn-12-131.pek2.redhat.com [10.72.12.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id E278C1C70E; Wed, 7 Mar 2018 08:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org; s=turing; t=1520412386; bh=j4PRh4PNWO1gxzntS/rzPLZvm9YQ9FVvFqrMLUgzFz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-help: List-unsubscribe:List-Id:List-subscribe:List-owner:List-post: List-archive; b=kaE/6dD50N+q04koWFofBgck3stEaspM595DlXjVDNgmH63JfEVcPafkPLqdrqRVy h8Pa+HEVIAYke+EaVtqZjJdiEMl1vp65dmzG7G30A1JtIzodkxJwzry+GCEtyubAZe /JSSFACjjwy4EUfsJ+aINwM7T4JXRvRuHJo+1/0Y= X-Virus-Scanned: Debian amavisd-new at turing.freelists.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org; s=turing; t=1520412386; bh=j4PRh4PNWO1gxzntS/rzPLZvm9YQ9FVvFqrMLUgzFz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-help: List-unsubscribe:List-Id:List-subscribe:List-owner:List-post: List-archive; b=kaE/6dD50N+q04koWFofBgck3stEaspM595DlXjVDNgmH63JfEVcPafkPLqdrqRVy h8Pa+HEVIAYke+EaVtqZjJdiEMl1vp65dmzG7G30A1JtIzodkxJwzry+GCEtyubAZe /JSSFACjjwy4EUfsJ+aINwM7T4JXRvRuHJo+1/0Y= X-Original-To: patchew-devel@freelists.org X-Virus-Scanned: Debian amavisd-new at turing.freelists.org From: Fam Zheng To: patchew-devel@freelists.org Cc: pbonzini@redhat.com Subject: [patchew-devel] [PATCH 3/7] testing: Optimized "testing-get" API call Date: Wed, 7 Mar 2018 16:46:05 +0800 Message-Id: <20180307084609.8515-4-famz@redhat.com> In-Reply-To: <20180307084609.8515-1-famz@redhat.com> References: <20180307084609.8515-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 07 Mar 2018 08:46:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 07 Mar 2018 08:46:25 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'famz@redhat.com' RCPT:'' X-archive-position: 87 X-ecartis-version: Ecartis v1.0.0 Sender: patchew-devel-bounce@freelists.org Errors-to: patchew-devel-bounce@freelists.org X-original-sender: famz@redhat.com Precedence: normal Reply-To: patchew-devel@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: patchew-devel X-List-ID: patchew-devel List-subscribe: List-owner: List-post: List-archive: X-list: patchew-devel X-ZohoMail-DKIM: pass (identity @freelists.org) X-ZohoMail-Owner: <20180307084609.8515-4-famz@redhat.com>+zmo_0_patchew-devel-bounce@freelists.org X-ZohoMail: RDKM_0 RSF_4 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With "testing.ready" property, we immediately mark series as "ready to test" when git apply is done, eliminating the need to do a relatively heavy search query. Signed-off-by: Fam Zheng --- mods/testing.py | 22 +++++++++++++++++----- tests/test_testing.py | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mods/testing.py b/mods/testing.py index 47933e2..80a22a5 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -23,7 +23,7 @@ import math from api.views import APILoginRequiredView from api.models import Message, Project, MessageProperty from api.search import SearchEngine -from event import emit_event, declare_event +from event import emit_event, declare_event, register_handler from patchew.logviewer import LogView from schema import * =20 @@ -112,6 +112,16 @@ class TestingModule(PatchewModule): test=3D"test name", log=3D"test log", is_timeout=3D"whether the test has timeout") + register_handler("SetProperty", self.on_set_property) + + def on_set_property(self, evt, obj, name, value, old_value): + if ((isinstance(obj, Message) and obj.is_series_head) \ + or isinstance(obj, Project)) \ + and name in ("git.tag", "git.repo") \ + and old_value is None \ + and obj.get_property("git.tag") and obj.get_property("git.repo= "): + self.remove_testing_properties(obj) + obj.set_property("testing.ready", 1) =20 def remove_testing_properties(self, obj, test=3D""): for k in list(obj.get_properties().keys()): @@ -174,6 +184,7 @@ class TestingModule(PatchewModule): all_tests =3D set([k for k, v in self.get_tests(obj).items() if v[= "enabled"]]) if all_tests.issubset(done_tests): obj.set_property("testing.done", True) + obj.set_property("testing.ready", None) if all_tests.issubset(done_tests): obj.set_property("testing.tested-head", head) emit_event("TestingReport", tester=3Dtester, user=3Duser.username, @@ -430,11 +441,12 @@ class TestingGetView(APILoginRequiredView): return po, td =20 def _find_series_test(self, request, po, tester, capabilities): - se =3D SearchEngine() - q =3D se.search_series("is:applied", "not:old", "not:tested", - "project:" + po.name) + q =3D MessageProperty.objects.filter(name=3D"testing.ready", + value=3D1, + message__project=3Dpo) candidate =3D None - for s in q: + for prop in q: + s =3D prop.message test =3D self._find_applicable_test(request.user, po, tester, capabilities, s) if not test: diff --git a/tests/test_testing.py b/tests/test_testing.py index cca3513..300201b 100755 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -46,6 +46,7 @@ class TestingTest(PatchewTestCase): if log is not None: self.msg.set_property("testing.log.tests", log) self.msg.set_property("testing.done", True) + self.msg.set_property("testing.ready", None) =20 def test_basic(self): self.api_login() --=20 2.14.3