Subject: bug#46402: Cuirass rebuilds the same packae multiple times

From: Ludovic Courtès <[email-masked]>
Date: Wed, 17 Feb 2021 15:22:21 +0100

Howdy!

Mathieu Othacehe <[email-masked]> skribis:

>> Seems to me that ‘BuildSteps’ is an orthogonal concern that has little
>> to do with Cuirass’ job and with its data model.  In Hydra I saw that as
>> a (necessary) kludge.
>
> I'm not sure to follow you here. Cuirass and Hydra have an almost
> identical database schema and are now working very similarly from what I
> understand.
>
> In Hydra, a JobSet (Specification in Cuirass) has several Builds. Each
> Build can be broken in several BuildSteps, corresponding to transitive
> derivation inputs that must be built.
>
> Hydra manages to get those BuildSteps to be built in a topological
> order, in the same way as the Guix Build Coordinator.
>
> This makes me think that we could implement this exact same mechanism in
> Cuirass but I'm maybe missing something.

When Cuirass was started, I wanted to avoid what I perceived as a
shortcoming of Hydra’s design: one daemon connection per job and build
steps, which kinda replicate what the daemon is doing.

So I suggested going for one connection for all the jobs and passing all
the derivations to the daemon so that the daemon can see the big picture,
make better scheduling decisions, and so we don’t have to re-implement
“build steps”.

But as you know, this strategy didn’t work out as expected because of
scalability issues in the daemon.

Regardless, it seems to me that ‘BuildSteps’ is a low-level thing
compared to the rest of the Cuirass database: it reifies part of the
derivation graph whereas the rest of the database is all about “jobs”
and “builds” thereof.  It’s not the same abstraction level.

I realize it’s somewhat subjective though and I don’t want to impede
progress!

>> If Cuirass would instead delegate derivation build requests to a
>> Coordinator/daemon-like thing, it wouldn’t have to worry about those
>> details.  That would better separate concerns.
>
> I think that having Cuirass delegating its builds to the Coordinator is
> not the right move. That would mean doubling the size of the CI code
> base, doubling the number of databases, for a feature that we could
> implement in Cuirass, just by making it catch-up on Hydra.

I see.  Generally speaking, I think better separation of concerns may
sometimes be worth extra code, insomuch as it makes it easier to reason
about things, to debug, and to add new features.  Of course it’s a
tradeoff; adding too much code just for the beauty of abstractions isn’t
reasonable either.

I wonder if having two databases instead of single one (which would
essentially be the union of those two databases) is a problem.  I guess
one problem is if that makes it hard to make commonly-needed “joins”
across the two databases.

Regarding features, one thing I like about the Coordinator is its
support for retrying builds, which could serve to detect flaky builds or
build processes that are kernel- or hardware-dependent.  I think it’s a
feature we’d want eventually, but I wonder if it should be Cuirass’s
job.

It’d be nice to focus on a single code base for “distributed builds” in
general, and I was hoping for a Coordinator/Cuirass convergence on this
aspect.  But at the end of the day, what matters most is what we
achieve.  Cuirass has been doing so much better on many fronts over the
last few weeks, including reliability, build throughput, and monitoring.
At the same time, the Coordinator proves useful and easy to deploy in
more experimental setups; I think Chris’s instance now aggregates
results from a variety of machines, including POWER and GNU/Hurd, and
that seemed quite easy to do.  I’m not going to complain about
over-success in this area!  :-)

Ludo’.