From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] offload: Memoize the 'machine-load' procedure Date: Wed, 17 Jun 2015 21:28:35 +0200 Message-ID: <87si9qw2vw.fsf@gnu.org> References: <87pp4udwav.fsf@netris.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5J0s-0007ee-MP for guix-devel@gnu.org; Wed, 17 Jun 2015 15:28:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5J0p-0004Cg-G6 for guix-devel@gnu.org; Wed, 17 Jun 2015 15:28:42 -0400 In-Reply-To: <87pp4udwav.fsf@netris.org> (Mark H. Weaver's message of "Wed, 17 Jun 2015 14:28:08 -0400") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Mark H Weaver Cc: guix-devel@gnu.org Mark H Weaver skribis: > This patch memoizes the 'machine-load' procedure so that the load of > each build slave is queried only once per call to 'guix offload'. Apart > from avoiding wasteful repeated ssh connections, this is needed to > ensure that all calls to the sorting predicate are consistent with each > other, which is part of the contract with 'sort'. Good point. I don=E2=80=99t think we can memoize it globally. The reason is that =E2=80=98choose-build-machine=E2=80=99 can return #f when all the machines = are overloaded; in that case =E2=80=98guix offload=E2=80=99 returns =E2=80=9Cpo= stpone=E2=80=9D, and doesn=E2=80=99t exit. Instead, it tries again until at least one machine is not overloaded. So I think we should memoize =E2=80=98machine-less-loaded-or-faster?=E2=80= =99 locally in =E2=80=98choose-build-machine=E2=80=99. WDYT? Thanks, Ludo=E2=80=99.