From 8e375335cd5d4eed54dd6d207d287318558f4bd0 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 19 Dec 2024 17:20:15 -0800 Subject: [PATCH] Related crawljob filtering by role (#2262) add filtering by role to related crawljobs query: - for regular crawls (role 'job'), only count other regular crawls - for qa runs (role 'qa-job') only count other qa jobs - ensures that concurrent crawl limits apply separately to regular crawls and qa runs - fixes #2261 --- backend/btrixcloud/operator/crawls.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/btrixcloud/operator/crawls.py b/backend/btrixcloud/operator/crawls.py index d170dd8c..a39064a1 100644 --- a/backend/btrixcloud/operator/crawls.py +++ b/backend/btrixcloud/operator/crawls.py @@ -580,11 +580,13 @@ class CrawlOperator(BaseOperator): spec = data.parent.get("spec", {}) crawl_id = spec["id"] oid = spec.get("oid") + # filter by role as well (job vs qa-job) + role = data.parent.get("metadata", {}).get("labels", {}).get("role") related_resources = [ { "apiVersion": BTRIX_API, "resource": "crawljobs", - "labelSelector": {"matchLabels": {"btrix.org": oid}}, + "labelSelector": {"matchLabels": {"btrix.org": oid, "role": role}}, }, ]