From nobody Thu Apr 25 10:39:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1550225072706431.1426201173107; Fri, 15 Feb 2019 02:04:32 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41954C1F78; Fri, 15 Feb 2019 10:04:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30E4860C69; Fri, 15 Feb 2019 10:04:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 23873181A00C; Fri, 15 Feb 2019 10:04:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1FA4U1B020220 for ; Fri, 15 Feb 2019 05:04:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1B41518155; Fri, 15 Feb 2019 10:04:30 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 093AE5DD6B for ; Fri, 15 Feb 2019 10:04:27 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AFC571219AF for ; Fri, 15 Feb 2019 10:04:25 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id l5so8588841wrw.6 for ; Fri, 15 Feb 2019 02:04:25 -0800 (PST) Received: from donizetti.lan ([2001:b07:6468:f312:89c2:7d3f:9ab:9545]) by smtp.gmail.com with ESMTPSA id t199sm21661915wmt.1.2019.02.15.02.04.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Feb 2019 02:04:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=A1Fa/MAgfgL3wmMRzSvZxMcOBqr/ksOMRYVfD5rI8jM=; b=SWLckPiWtl6aFAGoOcE9LjECZNOZHeL/x+GK1dcWpjtaD2/IKv/AgrRIV6vij/Zew1 nDXA3k1/m7xGvIrC4Oo23o61XJOfjlG70TtQztYJhlNaGfUkxIDn82iS47dLqh7SxkP4 WAfYz5EVuX+ON6CAJsnywKlUPDJOxn7HtHAYcpM5XtxPNfi8Xf8quSMY9GPqvduNAuSa HcWWrzG0wOMYBqg+7iGRpa3XIUXjpNM+uY2DtrM0aIMh8qyAWVhSA9s84XeaOkHoQD/+ VvGt791urdy88/IXHBpp43cYBl75XBZqsuwv7FXWf+P+uYKxPTseGdc3qlSshJplTxul JKTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version:content-transfer-encoding; bh=A1Fa/MAgfgL3wmMRzSvZxMcOBqr/ksOMRYVfD5rI8jM=; b=BAAkT2ZXej9+Mue0lQ8KB24749wsOP37eex0af6EVgqAllymWzLRYVIKwSqM6Xxa9a lUbzZ3rFDHMc5wYs6leBiJKSfaIM89YoTLb3h0OnZV0l3Zwgcrgps8JSegwcOav9sEZ2 3y19RnEXuPDFFNVsFdl101qyqRG4LAEcAeFQ4pVuM97eYVkO5EO0HvP77jZlWrV8MhrZ m3Y/FiN7qEUwjV7ONZKSDaduze5qCZ/KrF6ND4A+xaWaTLySTD2Q3CwK32EJW7rJ16KX QR2CnyOwXRb2O9I48E97uC+7SAJ4Klmynbb1vWvvSSePojpCfbFy3fWzkbZMn8e077Gi w9og== X-Gm-Message-State: AHQUAubS7gxRrL+jo8hVUzXmNUdrvOVwvnc5G+RC/oRWPG9615+1DQ1i qXQlAFYHNCud7cjI/rlCRzsWZz9L X-Google-Smtp-Source: AHgI3IZIHaI/cVx36AwE2kDyYUPw1oxk49ghyH6JTy/h7vhDz+sgefJKztwHWC4vD/BAvShi8Vzw1A== X-Received: by 2002:adf:c18c:: with SMTP id x12mr6463821wre.152.1550225063988; Fri, 15 Feb 2019 02:04:23 -0800 (PST) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Fri, 15 Feb 2019 11:04:22 +0100 Message-Id: <20190215100422.6032-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 15 Feb 2019 10:04:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 15 Feb 2019 10:04:25 +0000 (UTC) for IP:'209.85.221.67' DOMAIN:'mail-wr1-f67.google.com' HELO:'mail-wr1-f67.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.066 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.221.67 mail-wr1-f67.google.com 209.85.221.67 mail-wr1-f67.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] testing: do not restart jobs too soon X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 15 Feb 2019 10:04:31 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" If two testers can run the same jobs, they compete for recently started job= s if there is nothing else left to do. The right thing to do would be to move timeout= handling in the server, without needing intervention from the tester, and then you w= ould not need to pass back RUNNING tests in _find_applicable_test. For now, just re= lieve the pressure by not passing RUNNING tests until one hour has passed from the la= st attempt. Signed-off-by: Paolo Bonzini --- mods/testing.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/testing.py b/mods/testing.py index 66e86b1..650990e 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -15,6 +15,7 @@ from django.db.models import Q from django.urls import reverse from django.utils.html import format_html from mod import PatchewModule +import datetime import time import math from api.views import APILoginRequiredView @@ -456,8 +457,11 @@ class TestingGetView(APILoginRequiredView): =20 def _find_applicable_test(self, queryset, user, po, tester, capabiliti= es): # Prefer non-running tests, or tests that started the earliest - q =3D queryset.filter(status__in=3D(Result.PENDING, Result.RUNNING= ), - name__startswith=3D'testing.').order_by('statu= s', 'last_update') + one_hour_ago =3D datetime.datetime.now() - datetime.timedelta(0, 3= 600) + where =3D Q(status=3DResult.PENDING) + where =3D where | Q(status=3DResult.RUNNING, last_update__lt=3Done= _hour_ago) + where =3D where & Q(name__startswith=3D'testing.') + q =3D queryset.filter(where).order_by('status', 'last_update') tests =3D _instance.get_tests(po) for r in q: if isinstance(r, MessageResult) and not r.message.git_result.i= s_success(): --=20 2.20.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel