Skip to content
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

Merged
merged 2 commits into from
Sep 26, 2023

Conversation

praiskup
Copy link
Member

The default "max_workers" limit might be too large (e.g. in Fedora Copr it is 45) compared to the number of available workers of some architecture type (e.g. for s390x there's now max 18 workers, and ppc64le is often limited too due to #2869). This patch then brings another FUP mitigation.

@praiskup praiskup force-pushed the praiskup-owner-arch-limits branch from ff48c0d to 5f3f1a3 Compare September 14, 2023 08:59
lclass = ArchitectureWorkerLimit if tag_type == "arch" else \
BuildTagLimit
for tag_type in ["arch", "tag", "arch_per_owner"]:
match tag_type:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whaaat, we have pattern matching in python?!
TIL ... :-)

Copy link
Member Author

@praiskup praiskup Sep 15, 2023

Choose a reason for hiding this comment

The 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 fnmatch patterns (my shell deformation..) :-) TIL too, I actually thought this was just a dummy C switch-case alternative.

Copy link
Member

Choose a reason for hiding this comment

The 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

Copr owner (user or group).
"""
def __init__(self, architecture, limit):
def hasher(x):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably doesn't have to be nested if we make it @staticmethod

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that can be lambda, going to change...

@@ -133,6 +137,18 @@ def predicate(x):
super().__init__(predicate, limit, name="arch_{}".format(architecture))


class ArchitectureUserWorkerLimit(GroupWorkerLimit):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is probably nothing we can do but the inheritance doesn't look right (UserWorkerLimit from GroupWorkerLimit)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think we could rename GroupWorkerLimit into HashedWorkerLimit :-)?

@praiskup praiskup force-pushed the praiskup-owner-arch-limits branch 2 times, most recently from b0b8462 to b25f271 Compare September 20, 2023 10:12
The default "max_workers" limit might be too large (e.g. in Fedora Copr
it is 45) compared to the number of available workers of some
architecture type (e.g. for s390x there's now max 18 workers, and
ppc64le is often limited too due to fedora-copr#2869).  This patch then brings
another FUP mitigation.
The old name caused confusion, see PR#2909.  The new name better
describes what the class actually does.

Even though the dispatcher/worker/limit/etc. logic is supposed to be a
library-like code, at this point we don't know about any other users so
rename like this seems OK.
@praiskup praiskup force-pushed the praiskup-owner-arch-limits branch from b25f271 to 3f0536b Compare September 22, 2023 08:07
@nikromen nikromen self-assigned this Sep 25, 2023
@@ -6,7 +6,7 @@
%global tests_version 4
%global tests_tar test-data-copr-backend

%global copr_common_version 0.16.4.dev
%global copr_common_version 0.20.1.dev1
Copy link
Member

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?

Copy link
Member Author

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.

lclass = ArchitectureWorkerLimit if tag_type == "arch" else \
BuildTagLimit
for tag_type in ["arch", "tag", "arch_per_owner"]:
match tag_type:
Copy link
Member

Choose a reason for hiding this comment

The 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

@praiskup praiskup merged commit 739a509 into fedora-copr:main Sep 26, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants