1 |
On 11/18/19 4:21 PM, Sergei Trofimovich wrote: |
2 |
> repoman slows down ~linearly with amount of profiles being scanned. |
3 |
> In case of amd64 we have 28 stable profiles. |
4 |
> |
5 |
> To speed up processing and fit into time budged of various CIs we can |
6 |
> split the work across different processes that handle different profiles. |
7 |
> |
8 |
> Example benchmark on ::haskell overlay: |
9 |
> $ ./repoman full --include-arches=amd64 |
10 |
> ~65 minutes |
11 |
> $ ./repoman full --include-profiles=default/linux/amd64/17.0 |
12 |
> ~4 minutes |
13 |
> This allows for a crude sharding of work across processes and allows for |
14 |
> cheap tree-wide scans for early failures. |
15 |
> |
16 |
> Bug: https://bugs.gentoo.org/700456 |
17 |
> Signed-off-by: Sergei Trofimovich <slyfox@g.o> |
18 |
> --- |
19 |
> repoman/lib/repoman/actions.py | 4 ++++ |
20 |
> repoman/lib/repoman/argparser.py | 7 +++++++ |
21 |
> repoman/lib/repoman/modules/scan/depend/__init__.py | 3 ++- |
22 |
> repoman/lib/repoman/modules/scan/depend/profile.py | 9 +++++++-- |
23 |
> repoman/lib/repoman/scanner.py | 5 +++++ |
24 |
> repoman/man/repoman.1 | 4 ++++ |
25 |
> 6 files changed, 29 insertions(+), 3 deletions(-) |
26 |
> |
27 |
> diff --git a/repoman/lib/repoman/actions.py b/repoman/lib/repoman/actions.py |
28 |
> index 1c9989a72..92d4d4e94 100644 |
29 |
> --- a/repoman/lib/repoman/actions.py |
30 |
> +++ b/repoman/lib/repoman/actions.py |
31 |
> @@ -412,6 +412,10 @@ the whole commit message to abort. |
32 |
> report_options.append( |
33 |
> "--include-arches=\"%s\"" % |
34 |
> " ".join(sorted(self.scanner.include_arches))) |
35 |
> + if self.scanner.include_profiles is not None: |
36 |
> + report_options.append( |
37 |
> + "--include-profiles=\"%s\"" % |
38 |
> + " ".join(sorted(self.scanner.include_profiles))) |
39 |
> |
40 |
> if portage_version is None: |
41 |
> sys.stderr.write("Failed to insert portage version in message!\n") |
42 |
> diff --git a/repoman/lib/repoman/argparser.py b/repoman/lib/repoman/argparser.py |
43 |
> index fa0e6ff90..670a0e91d 100644 |
44 |
> --- a/repoman/lib/repoman/argparser.py |
45 |
> +++ b/repoman/lib/repoman/argparser.py |
46 |
> @@ -164,6 +164,13 @@ def parse_args(argv, repoman_default_opts): |
47 |
> 'A space separated list of arches used to ' |
48 |
> 'filter the selection of profiles for dependency checks')) |
49 |
> |
50 |
> + parser.add_argument( |
51 |
> + '--include-profiles', |
52 |
> + dest='include_profiles', metavar='PROFILES', action='append', |
53 |
> + help=( |
54 |
> + 'A space separated list of profiles used to ' |
55 |
> + 'define the selection of profiles for dependency checks')) |
56 |
> + |
57 |
> parser.add_argument( |
58 |
> '-d', '--include-dev', dest='include_dev', action='store_true', |
59 |
> default=False, |
60 |
> diff --git a/repoman/lib/repoman/modules/scan/depend/__init__.py b/repoman/lib/repoman/modules/scan/depend/__init__.py |
61 |
> index c3cc0ddeb..9068760bb 100644 |
62 |
> --- a/repoman/lib/repoman/modules/scan/depend/__init__.py |
63 |
> +++ b/repoman/lib/repoman/modules/scan/depend/__init__.py |
64 |
> @@ -19,7 +19,8 @@ module_spec = { |
65 |
> 'func_desc': { |
66 |
> }, |
67 |
> 'mod_kwargs': ['qatracker', 'portdb', 'profiles', 'options', |
68 |
> - 'repo_metadata', 'repo_settings', 'include_arches', 'caches', |
69 |
> + 'repo_metadata', 'repo_settings', 'include_arches', |
70 |
> + 'include_profiles', 'caches', |
71 |
> 'repoman_incrementals', 'env', 'have', 'dev_keywords' |
72 |
> ], |
73 |
> 'func_kwargs': { |
74 |
> diff --git a/repoman/lib/repoman/modules/scan/depend/profile.py b/repoman/lib/repoman/modules/scan/depend/profile.py |
75 |
> index d980f4eca..0b1d74483 100644 |
76 |
> --- a/repoman/lib/repoman/modules/scan/depend/profile.py |
77 |
> +++ b/repoman/lib/repoman/modules/scan/depend/profile.py |
78 |
> @@ -33,6 +33,7 @@ class ProfileDependsChecks(ScanBase): |
79 |
> @param options: cli options |
80 |
> @param repo_settings: repository settings instance |
81 |
> @param include_arches: set |
82 |
> + @param include_profiles: set |
83 |
> @param caches: dictionary of our caches |
84 |
> @param repoman_incrementals: tuple |
85 |
> @param env: the environment |
86 |
> @@ -46,6 +47,7 @@ class ProfileDependsChecks(ScanBase): |
87 |
> self.options = kwargs.get('options') |
88 |
> self.repo_settings = kwargs.get('repo_settings') |
89 |
> self.include_arches = kwargs.get('include_arches') |
90 |
> + self.include_profiles = kwargs.get('include_profiles') |
91 |
> self.caches = kwargs.get('caches') |
92 |
> self.repoman_incrementals = kwargs.get('repoman_incrementals') |
93 |
> self.env = kwargs.get('env') |
94 |
> @@ -81,8 +83,11 @@ class ProfileDependsChecks(ScanBase): |
95 |
> if arch not in self.include_arches: |
96 |
> continue |
97 |
> |
98 |
> - relevant_profiles.extend( |
99 |
> - (keyword, groups, prof) for prof in self.profiles[arch]) |
100 |
> + for prof in self.profiles[arch]: |
101 |
> + if self.include_profiles is not None: |
102 |
> + if prof not in self.include_profiles: |
103 |
> + continue |
104 |
> + relevant_profiles.append((keyword, groups, prof)) |
105 |
> |
106 |
> relevant_profiles.sort(key=sort_key) |
107 |
> |
108 |
> diff --git a/repoman/lib/repoman/scanner.py b/repoman/lib/repoman/scanner.py |
109 |
> index 1b3242a51..06234b0ad 100644 |
110 |
> --- a/repoman/lib/repoman/scanner.py |
111 |
> +++ b/repoman/lib/repoman/scanner.py |
112 |
> @@ -164,6 +164,10 @@ class Scanner(object): |
113 |
> if self.options.include_arches: |
114 |
> self.include_arches = set() |
115 |
> self.include_arches.update(*[x.split() for x in self.options.include_arches]) |
116 |
> + self.include_profiles = None |
117 |
> + if self.options.include_profiles: |
118 |
> + self.include_profiles = set() |
119 |
> + self.include_profiles.update(*[x.split() for x in self.options.include_profiles]) |
120 |
> |
121 |
> # Disable the "self.modules['Ebuild'].notadded" check when not in commit mode and |
122 |
> # running `svn status` in every package dir will be too expensive. |
123 |
> @@ -190,6 +194,7 @@ class Scanner(object): |
124 |
> "repo_metadata": self.repo_metadata, |
125 |
> "profiles": profiles, |
126 |
> "include_arches": self.include_arches, |
127 |
> + "include_profiles": self.include_profiles, |
128 |
> "caches": self.caches, |
129 |
> "repoman_incrementals": self.repoman_incrementals, |
130 |
> "env": self.env, |
131 |
> diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1 |
132 |
> index 766146f57..f33fb6098 100644 |
133 |
> --- a/repoman/man/repoman.1 |
134 |
> +++ b/repoman/man/repoman.1 |
135 |
> @@ -120,6 +120,10 @@ Ignore masked packages (not allowed with commit mode) |
136 |
> A space separated list of arches used to filter the selection of |
137 |
> profiles for dependency checks. |
138 |
> .TP |
139 |
> +.BR "\-\-include\-profiles " PROFILES |
140 |
> +A space separated list of profiles used to |
141 |
> +define the selection of profiles for dependency checks. |
142 |
> +.TP |
143 |
> \fB\-d\fR, \fB\-\-include\-dev\fR |
144 |
> Include dev profiles in dependency checks. |
145 |
> .TP |
146 |
> |
147 |
|
148 |
Looks good. Please merge. |
149 |
-- |
150 |
Thanks, |
151 |
Zac |