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
This commit is contained in:
Ilya Kreymer 2024-12-19 17:20:15 -08:00 committed by GitHub
parent 60d07762be
commit 8e375335cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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}},
},
]