-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backend: provide per-arch & per-owner worker limit #2909
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,11 @@ | |
BuildDispatcher related classes. | ||
""" | ||
|
||
from copr_common.worker_manager import GroupWorkerLimit | ||
from copr_common.worker_manager import HashWorkerLimit | ||
from copr_backend.dispatcher import BackendDispatcher | ||
from copr_backend.rpm_builds import ( | ||
ArchitectureWorkerLimit, | ||
ArchitectureUserWorkerLimit, | ||
BuildTagLimit, | ||
RPMBuildWorkerManager, | ||
BuildQueueTask, | ||
|
@@ -83,17 +84,22 @@ def __init__(self, backend_opts): | |
super().__init__(backend_opts) | ||
self.max_workers = backend_opts.builds_max_workers | ||
|
||
for tag_type in ["arch", "tag"]: | ||
lclass = ArchitectureWorkerLimit if tag_type == "arch" else \ | ||
BuildTagLimit | ||
for tag_type in ["arch", "tag", "arch_per_owner"]: | ||
match tag_type: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whaaat, we have pattern matching in python?! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, but when someone says "pattern" matching, I expect it to work with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not a huge fan of switch cases in python, I'd personally use a tuple in for loop to get rid of match but it's just syntax preference |
||
case "arch": | ||
lclass = ArchitectureWorkerLimit | ||
case "tag": | ||
lclass = BuildTagLimit | ||
case "arch_per_owner": | ||
lclass = ArchitectureUserWorkerLimit | ||
for tag, limit in backend_opts.builds_limits[tag_type].items(): | ||
self.log.info("setting %s(%s) limit to %s", tag_type, tag, limit) | ||
self.limits.append(lclass(tag, limit)) | ||
|
||
for limit_type in ['sandbox', 'owner']: | ||
max_builders = backend_opts.builds_limits[limit_type] | ||
self.log.info("setting %s limit to %s", limit_type, max_builders) | ||
self.limits.append(GroupWorkerLimit( | ||
self.limits.append(HashWorkerLimit( | ||
lambda x, limit=limit_type: getattr(x, limit), | ||
max_builders, | ||
name=limit_type, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to jump to version 20 instead of 17?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ar jumping from 0.20.1 => 0.20.1.dev1; this is just a requirement that we haven't had to bump for quite some time.