all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Sergio Pastor Pérez" <sergio.pastorperez@outlook.es>
To: guix-devel@gnu.org
Subject: Should we document how to detect if build machines are reachable before trying to offload?
Date: Thu, 04 Jul 2024 17:45:29 +0200	[thread overview]
Message-ID: <PAXP251MB0348A79774180247EDFD3E6BF3DE2@PAXP251MB0348.EURP251.PROD.OUTLOOK.COM> (raw)

Hello.

I recently discovered that offloading builds to remote machines[1],
hangs when the machines are not available; instead of defaulting to
building locally[2]. This forces the user to use the `--no-offload`
flag.

I saw in the mailing list[2] that someone suggested that, the
`build-machines` field accepts a list of GEXPs instead of plain
`build-machine` record types.

This suggestion is almost correct but it only checks if the host is
known which does not guarantee that it is reachable. Therefore I came up
with this:
--8<---------------cut here---------------start------------->8---
(build-machines
 (list
  #~(let* ((resolvable? (lambda (machine)
                          (zero? (system* #$(file-append netcat "/bin/nc")
                                          "-z" "-w1"
                                          (build-machine-name machine) "22")))))
      (filter resolvable?
              (list (build-machine
                     (name "my-host")
                     (systems (list "x86_64-linux" "i686-linux"))
                     ;; NOTE: Located in '/etc/ssh/ssh_host_ed25519_key.pub' on the machine that does the build.
                     ;; It will be generated by `openssh-service-type'.
                     (host-key #$(plain-file-content %my-host-host-key))
                     ;; NOTE: User on the build machine that allows SSH access with the key from `private-key' field.
                     (user "my-host-user1")
                     (private-key "/home/user1/.ssh/id_ed25519")))))))
--8<---------------cut here---------------end--------------->8---

Which allows to dynamically detect which machines are reachable.

If the user wanted to never build locally, the `-M 0` flag can be
used. Therefore, I would expect that it would graciously fallback to
building locally instead of getting stuck. If this is the desired
behaviour, I think we should document how to avoid the hanging.

Should we add this snippet to the manual/cookbook?

[1] https://guix.gnu.org/manual/en/html_node/Daemon-Offload-Setup.html
[2] https://lists.gnu.org/archive/html/help-guix/2023-12/msg00114.html
[3] https://lists.gnu.org/archive/html/help-guix/2023-12/msg00120.html


Regards,
Sergio.


             reply	other threads:[~2024-07-04 15:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 15:45 Sergio Pastor Pérez [this message]
2024-07-11  9:48 ` Should we document how to detect if build machines are reachable before trying to offload? Ludovic Courtès
2024-07-11 20:23   ` Sergio Pastor Pérez
2024-07-21 12:56     ` Ludovic Courtès
2024-07-21 15:59       ` Sergio Pastor Pérez
2024-07-21 16:26       ` Vincent Legoll
2024-07-21 17:25         ` Tomas Volf
2024-07-22 14:59       ` Simon Tournier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAXP251MB0348A79774180247EDFD3E6BF3DE2@PAXP251MB0348.EURP251.PROD.OUTLOOK.COM \
    --to=sergio.pastorperez@outlook.es \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.