From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id +ODaIwAam2IvTgEAbAwnHQ (envelope-from ) for ; Sat, 04 Jun 2022 10:38:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id IDIDIwAam2JYXgAAG6o9tA (envelope-from ) for ; Sat, 04 Jun 2022 10:38:24 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4AAA513E98 for ; Sat, 4 Jun 2022 10:38:24 +0200 (CEST) Received: from localhost ([::1]:46782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxPIc-0002ar-P8 for larch@yhetil.org; Sat, 04 Jun 2022 04:38:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxPIJ-0002X9-PA for guix-patches@gnu.org; Sat, 04 Jun 2022 04:38:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxPII-00046h-Jv for guix-patches@gnu.org; Sat, 04 Jun 2022 04:38:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nxPII-00077W-Hc for guix-patches@gnu.org; Sat, 04 Jun 2022 04:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55792] [PATCH 3/3] hydra: web: Make mcron job derivations deterministic. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 04 Jun 2022 08:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55792 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55792@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 55792-submit@debbugs.gnu.org id=B55792.165433187527344 (code B ref 55792); Sat, 04 Jun 2022 08:38:02 +0000 Received: (at 55792) by debbugs.gnu.org; 4 Jun 2022 08:37:55 +0000 Received: from localhost ([127.0.0.1]:57623 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxPIB-00076y-Dx for submit@debbugs.gnu.org; Sat, 04 Jun 2022 04:37:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxPIA-00076a-Cf for 55792@debbugs.gnu.org; Sat, 04 Jun 2022 04:37:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxPI5-000466-4w; Sat, 04 Jun 2022 04:37:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=3uX5daEgeP3qpagwAg7GKzpdAiR2H+CWyiIQTwUM4LQ=; b=i/Pm8q6Vaxhb5KYarp8N F0LxJ2jHg25v2jImXg7jKWLVd8qQXClBvBy87KSdkhOr99/1UZDZss2TFSD+uSXLL78ZJY8MFSW/M Q+DDiTXzJvemuJm9rsFBThXibpzfdCzGiX8tUlO8l6buXinbBleSh0e4zzZD0yahebc9e2/1MoPUE r4afsRKeCfWnPlycFHh1njd0OnsAEuiQcifqSowZcVQemgar2Pk1oFpGX5DLBMx0e+8ClWx0Z7yq5 M5KnoR1/UoNXSYKsc7BrRWU0JFwGmN1pcu3OvG17AgpQa8OdXSxlD6Nh0imCDyC/E/tmn0zA3f7TL 3XJb6sLHdfGfiA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:60197 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxPI4-0005ty-IK; Sat, 04 Jun 2022 04:37:48 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 4 Jun 2022 10:37:36 +0200 Message-Id: <20220604083736.22152-3-ludo@gnu.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220604083736.22152-1-ludo@gnu.org> References: <20220604083736.22152-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654331904; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=3uX5daEgeP3qpagwAg7GKzpdAiR2H+CWyiIQTwUM4LQ=; b=PyKseKyhKRy8I47sr6EnwTmg5B/scdGuFpV9XAQV3Lk8lztF2lOU2iOHV8qZnsi79j3/jV JSAJL0QFp8kYrHuhWjI/kPK9ovscVNLPBDjB8fcyRrd1Toqu894BuV3D+TWkwj4LTBI5U9 q9f8zylcBNSGZaFRE8tqxTDRPkwToCOvWRKK3oKb8DfLvpVcjObxuw147er0lhIpegtGQl mP31SmjOCjBq5Q8iDKcMzpoB9cLkRqh3TxzpIOWgoGiU8t/RwhXtUWUrcir0TPrPv6Gsq1 lp1akSKTOTu4gokvbbC2okqNeVgLNk5TSi6DQGjJPCkoDdrlJP4HYEprKufB1w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654331904; a=rsa-sha256; cv=none; b=O+ZZaMqoPh89fhcJ/uXW9iGbTrVtyrbGKDYnbkwOIYeXAbJ0lpnG+MCV4pZkkWnSx5wDiw HLOmtyYGrQoha6aoTLnG4YSMH950C90AiU6FFg4wvODRgLctzj7P8NhpuRE+LJPc26XQxJ d82xEho88XOm3EOhIDJnlGUK+uvC/1pfEtjEDJDsy48iIY8F3lvRIn1nvNRSFd508E/ljT VkRbqxrtvnB1bqxg/Gl+3WvNpORWuRuQ3MTwatdPdy/N8oTxfHVHmwUXZfnn19W+XQ45be AHSfbNDe8AOeZ2OdX506/8vTbuI3SZPvU3JEpCEeeLbQeODc/5byqBaYVH0/VA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="i/Pm8q6V"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="i/Pm8q6V"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4AAA513E98 X-Spam-Score: -2.42 X-Migadu-Scanner: scn1.migadu.com X-TUID: QC+w4tSbwy3P The result of (hash config period) varies between runs. Thus, starting from bdb914a1242cb0c00957050c96d1e279d2eb5dec, each run of "guix system build -d ..." would produce a different derivation. This commit fixes that. * hydra/modules/sysadmin/web.scm (static-web-site-mcron-jobs)[record->list]: New procedure. Use it. --- hydra/modules/sysadmin/web.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hydra/modules/sysadmin/web.scm b/hydra/modules/sysadmin/web.scm index e04ac1b..f26ed24 100644 --- a/hydra/modules/sysadmin/web.scm +++ b/hydra/modules/sysadmin/web.scm @@ -179,11 +179,19 @@ that's built with Haunt or similar." (basename (static-web-site-configuration-directory config))))) + (define (record->list record) + (let ((fields (record-type-fields ))) + (map (lambda (n) + (struct-ref record n)) + (iota (length fields))))) + (map (lambda (config) ;; Add an offset to spread web site updates over the period to avoid I/O - ;; load peaks when there are several such jobs. + ;; load peaks when there are several such jobs. Compute a hash over + ;; a list representation of CONFIG, rather than over CONFIG, because + ;; hash of a struct depends on the object identity of its vtable. (let* ((period (static-web-site-configuration-period config)) - (offset (hash config period))) + (offset (hash (record->list config) period))) #~(job (lambda (now) (let ((elapsed (modulo now #$period))) (+ now (- #$period elapsed) #$offset))) -- 2.36.1