From efdc800d3fd41aa3d65cdd3475e0d895614f460b Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 28 Aug 2023 14:47:28 +0200 Subject: dashboard: support per-Manager priority There are cases when we want to give priority to bugs from particular managers, e.g. we want to make qemu crashes stay below GCE-based ones. Add a Priority field to ConfigManager. There should be no problems rolling this out -- newer crashes of high-priority crashes will get a higher priority than before, but that's good, we do want newer crashes to be higher. --- dashboard/app/api.go | 3 +++ dashboard/app/config.go | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/dashboard/app/api.go b/dashboard/app/api.go index bca45f6e9..92e4ee899 100644 --- a/dashboard/app/api.go +++ b/dashboard/app/api.go @@ -855,6 +855,9 @@ func (crash *Crash) UpdateReportingPriority(c context.Context, build *Build, bug if crash.Title == bug.Title { prio += 1e8 // prefer reporting crash that matches bug title } + if _, mgrConfig := activeManager(crash.Manager, bug.Namespace); mgrConfig != nil { + prio += int64((mgrConfig.Priority - MinManagerPriority) * 1e5) + } if build.Arch == targets.AMD64 { prio += 1e3 } diff --git a/dashboard/app/config.go b/dashboard/app/config.go index e845852fc..9715c632a 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -204,8 +204,16 @@ type ConfigManager struct { FixBisectionDisabled bool // CC for all bugs that happened only on this manager. CC CCConfig + // Other parameters being equal, Priority helps to order bug's crashes. + // Priority is an integer in the range [-3;3]. + Priority int } +const ( + MinManagerPriority = -3 + MaxManagerPriority = 3 +) + // One reporting stage. type Reporting struct { // See GlobalConfig.AccessLevel. @@ -626,6 +634,10 @@ func checkManager(ns, name string, mgr ConfigManager) { if mgr.ObsoletingMinPeriod != 0 && mgr.ObsoletingMinPeriod < 24*time.Hour { panic(fmt.Sprintf("manager %v/%v obsoleting: too low MinPeriod", ns, name)) } + if mgr.Priority < MinManagerPriority && mgr.Priority > MaxManagerPriority { + panic(fmt.Sprintf("manager %v/%v priority is not in the [%d;%d] range", + ns, name, MinManagerPriority, MaxManagerPriority)) + } checkCC(&mgr.CC) } -- cgit mrf-deployment