unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should we document how to detect if build machines are reachable before trying to offload?
@ 2024-07-04 15:45 Sergio Pastor Pérez
  2024-07-11  9:48 ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Sergio Pastor Pérez @ 2024-07-04 15:45 UTC (permalink / raw)
  To: guix-devel

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-07-22 16:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-04 15:45 Should we document how to detect if build machines are reachable before trying to offload? Sergio Pastor Pérez
2024-07-11  9:48 ` 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).