From nobody Tue Feb 10 03:44:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1596196588; cv=none; d=zohomail.com; s=zohoarc; b=V5744s7ib5kwa0kxqoMFU2KLTn0idBNECiNrwpmTWt1e1RGUxCpjIqYUu/wYsHerXk8PMlbS2/RJn2T9bKpGhsMHP3dVsQKDJCZ/rztEBgcawr5KHNgEmmMH9Xv9/JqkM25b32s92uaPKrrL4KrrnlkwyOVkvlfrd3tcXM4AmiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596196588; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iY+M1XZO2pSKL1zFU6kXsa95FO4XLmksOQwoHa9X8x4=; b=O8S/sU1GsvjHJXOcJs2XeV/zLdk32kYVaTNroe77tokN9YqV0s6OadFsTnctEPpA4qlg0bZRY9QZD1OJWotjFl1z2QF62ySwT4kd6GBtU26xe6f8rEMrrooEqUenX/MmUpqkFnBYxuRL2WtRN/GIJDjVu+At9HQ/mCUKjUAxAT8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1596196588410569.0727686374328; Fri, 31 Jul 2020 04:56:28 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k1Tdy-00005B-S1; Fri, 31 Jul 2020 11:56:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k1Tdx-0008RD-Td for xen-devel@lists.xenproject.org; Fri, 31 Jul 2020 11:56:09 +0000 Received: from chiark.greenend.org.uk (unknown [2001:ba8:1e3::]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d21043bf-d324-11ea-8e29-bc764e2007e4; Fri, 31 Jul 2020 11:56:09 +0000 (UTC) Received: from [172.18.45.5] (helo=zealot.relativity.greenend.org.uk) by chiark.greenend.org.uk (Debian Exim 4.84_2 #1) with esmtp (return-path ijackson@chiark.greenend.org.uk) id 1k1TMx-0001W4-0B; Fri, 31 Jul 2020 12:38:35 +0100 X-Inumbo-ID: d21043bf-d324-11ea-8e29-bc764e2007e4 From: Ian Jackson To: xen-devel@lists.xenproject.org Subject: [OSSTEST PATCH v2 21/41] sg-report-host-history: Find flight limit by flight start date Date: Fri, 31 Jul 2020 12:38:00 +0100 Message-Id: <20200731113820.5765-22-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200731113820.5765-1-ian.jackson@eu.citrix.com> References: <20200731113820.5765-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Type: text/plain; charset="utf-8" By default we look for anything in (roughly) the last year. This query is in fact quite fast because the flights table is small. There is still the per-host limit of $limit (2000) recent runs. Signed-off-by: Ian Jackson --- sg-report-host-history | 56 ++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/sg-report-host-history b/sg-report-host-history index 9730ae7a..a159df3e 100755 --- a/sg-report-host-history +++ b/sg-report-host-history @@ -29,6 +29,7 @@ use POSIX; use Osstest::Executive qw(:DEFAULT :colours); =20 our $limit=3D 2000; +our $timelimit=3D 86400 * (366 + 14); our $flightlimit; our $htmlout =3D "."; our $read_existing=3D1; @@ -45,6 +46,8 @@ while (@ARGV && $ARGV[0] =3D~ m/^-/) { last if m/^--?$/; if (m/^--(limit)\=3D([1-9]\d*)$/) { $$1=3D $2; + } elsif (m/^--time-limit\=3D([1-9]\d*)$/) { + $timelimit=3D $1; } elsif (m/^--flight-limit\=3D([1-9]\d*)$/) { $flightlimit=3D $1; } elsif (restrictflight_arg($_)) { @@ -108,38 +111,33 @@ sub read_existing_logs ($) { } =20 sub computeflightsrange () { - if (!$flightlimit) { - my $flagscond =3D - '('.join(' OR ', map { "f.hostflag =3D 'blessed-$_'" } @blessings).')= '; - my $nhostsq =3D db_prepare(<execute(); - my ($nhosts) =3D $nhostsq->fetchrow_array(); - print DEBUG "COUNTED $nhosts hosts\n"; - $flightlimit =3D $nhosts * $limit * 2; - } - - my $minflightsq =3D db_prepare(<execute(); + ($minflight,) =3D $minflightsq->fetchrow_array(); + } else { + my $minflightsq =3D db_prepare(<=3D ? + ORDER BY flight ASC + LIMIT 1 END - $minflightsq->execute(); - ($minflight,) =3D $minflightsq->fetchrow_array(); + my $now =3D time // die $!; + $minflightsq->execute($now - $timelimit); + ($minflight,) =3D $minflightsq->fetchrow_array(); + } $minflight //=3D 0; =20 $flightcond =3D "(flight > $minflight)"; --=20 2.20.1