Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH 1/2] portdbapi: add async_aux_get method (bug 648790)
Date: Mon, 26 Feb 2018 19:58:20
Message-Id: 1519675092.1702.11.camel@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH 1/2] portdbapi: add async_aux_get method (bug 648790) by Zac Medico
1 W dniu pon, 26.02.2018 o godzinie 11∶40 -0800, użytkownik Zac Medico
2 napisał:
3 > On 02/26/2018 11:23 AM, Michał Górny wrote:
4 > > W dniu pon, 26.02.2018 o godzinie 10∶09 -0800, użytkownik Zac Medico
5 > > napisał:
6 > > > On 02/26/2018 04:29 AM, Michał Górny wrote:
7 > > > > W dniu nie, 25.02.2018 o godzinie 17∶50 -0800, użytkownik Zac Medico
8 > > > > napisał:
9 > > > > > Add async_aux_get method that returns a Future and otherwise
10 > > > > > behaves identically to aux_get. Use async_aux_get to implement
11 > > > > > the synchronous aux_get method.
12 > > > > >
13 > > > > > Bug: https://bugs.gentoo.org/648790
14 > > > > > ---
15 > > > > > pym/portage/dbapi/porttree.py | 91 +++++++++++++++++++++++++++++++++----------
16 > > > > > 1 file changed, 70 insertions(+), 21 deletions(-)
17 > > > > >
18 > > > >
19 > > > > What's the exact use case? What's the gain, in numbers?
20 > > >
21 > > > I'm planning to use the for repoman, since it commonly has to generate
22 > > > metadata for multiple packages a once, when dealing with ebuild or
23 > > > eclass modifications.
24 > > >
25 > > > The gain in numbers is that it scales linearly with the number of
26 > > > available cores.
27 > > >
28 > > > > This seems like a lot of added complexity.
29 > > >
30 > > > It doesn't really add complexity, asynchronous code or this sort is
31 > > > already used throughout portage internals. Asynchronous methods like
32 > > > these are quite standard today, thanks to asyncio.
33 > > >
34 > > > > With Portage being practically unmaintainable,
35 > > >
36 > > > Any reasonably complex codebase appears to be unmaintainable to those
37 > > > who don't maintain it.
38 > > >
39 > > > > I'm against any changes that make things worse without
40 > > > > clearly defined major benefit.
41 > > >
42 > > > Transitioning to asynchronous interfaces like this is unavoidable as we
43 > > > move into the realm of asyncio compatibility.
44 > >
45 > > I think we can agree that functions like aux_get() that rely on callers
46 > > providing constant parameters to obtain the necessary output are far
47 > > from optimal. I believe Portage should aim towards transitioning callers
48 > > to more object-oriented APIs.
49 >
50 > That's fine but aux_get is a public API that will remain supported until
51 > we have a replacement, and async_aux_get will be an immediately useful
52 > enhancement to an existing API.
53
54 No, it will become a new public API which we will end up supporting
55 forever.
56
57 >
58 > > That's why I'm opposed to *proliferating* bad APIs. Maybe I'm wrong but
59 > > I don't believe this code would be helpful in transitioning Portage to
60 > > object-oriented API.
61 >
62 > I'd welcome the addition of new APIs, but that should not block the
63 > enhancement of existing APIs.
64
65 --
66 Best regards,
67 Michał Górny

Replies