Skip to content

Commit

Permalink
Related crawljob filtering by role (#2262)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ikreymer authored Dec 20, 2024
1 parent 60d0776 commit 8e37533
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/btrixcloud/operator/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,13 @@ def get_related(self, data: MCBaseRequest):
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}},
},
]

Expand Down

0 comments on commit 8e37533

Please sign in to comment.