Commit Graph

1152 Commits

Author SHA1 Message Date
Ludovic Courtès 8cd9986cbd
database: ‘db-get-first-build-failure’ really does that.
There could potentially be cases where it would return a succeeding
build.

* src/cuirass/database.scm (db-get-first-build-failure):
Add (status . failed) filter.
2023-10-18 17:50:09 +02:00
Ludovic Courtès e9c27b7ce5
templates: Do not show “Weather” row when weather is unknown.
* src/cuirass/templates.scm (build-details): Do not emit “Weather” row
when WEATHER is unknown.
2023-10-18 16:03:07 +02:00
Ludovic Courtès 5fbbd26a78
http: Really fix previous checkout computation.
This a followup to c6fa409ad0.

* src/cuirass/http.scm (url-handler): Deal with the case where BUILD is
false or ‘db-get-previous-eval’ returns #f.
2023-10-18 15:58:45 +02:00
Ludovic Courtès c6fa409ad0
http: Grab checkouts of the previous evaluations for “/build/ID/details”.
In commit df606ce452, we were showing the
checkouts of the evaluation of the previous build.  However, that’s
typically much older than checkouts of the previous evaluation, which
are known to have led to the same successful build.

* src/cuirass/http.scm (url-handler): In “/build/ID/details”, compute
‘previous-checkouts’ based on the previous evaluation.
2023-10-18 15:44:24 +02:00
Ludovic Courtès df606ce452
templates: Provide hints for build failures.
The goal is to make it easier to find the origin of a build failure.

* src/cuirass/templates.scm (build-details): Add #:channels,
 #:checkouts, #:previous-checkouts, and #:first-failure.
[build-failure-info]: New procedure.
Use it.
(checkout-change-table): New procedure.
* src/cuirass/http.scm (url-handler): In “/build/ID/details”, pass extra
arguments to ‘build-details’.
* TODO: Update.
2023-10-18 15:03:27 +02:00
Ludovic Courtès 1db03a8c61
templates: Make “Build history” heading more visible.
* src/cuirass/templates.scm (build-details): Use ‘div’ instead of ‘h6’
for the “Build history” heading.
2023-10-18 15:03:27 +02:00
Ludovic Courtès cc31d28621
templates: ‘commit-hyperlink’ can display shortened commit IDs.
* src/cuirass/templates.scm (commit-hyperlink): Add #:shorten?
parameter, and honor it.
2023-10-18 15:03:27 +02:00
Ludovic Courtès ef3d3164b6
examples: random: Define a “build product” for some jobs.
* examples/random.scm: Add ‘build-outputs’ field.
2023-10-18 15:03:27 +02:00
Ludovic Courtès 8536509804
database: Add ‘db-get-first-build-failure’.
* src/cuirass/database.scm (db-get-previous-successful-build)
(db-get-first-build-failure): New procedures.
* tests/database.scm ("db-get-first-build-failure"): New test.
2023-10-18 15:03:26 +02:00
Ludovic Courtès 203b282220
tests: Avoid hard-coded ‘build-status’ values.
* tests/database.scm ("db-update-build-status!"): Replace hard-coded
‘build-status’ constants.
2023-10-18 15:03:26 +02:00
Ludovic Courtès fcab29cd36
base: Improve build product logging.
* src/cuirass/base.scm (create-build-outputs): Tweak logging.
2023-10-18 15:03:26 +02:00
Ludovic Courtès 053fff02e4
doc: Fix typo.
* doc/cuirass.texi (Specifications): Fix typo.
2023-10-18 15:03:26 +02:00
vicvbcun f63bd5ea64
doc: Fix remaining evaluation hook example.
This is a follow-up to commit 0b63c3b698.

* doc/cuirass.texi (Triggering an Evaluation): Fix URL in example.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-10-17 10:36:09 -04:00
vicvbcun 0b63c3b698
doc: Fix evaluation hook URL example.
* doc/cuirass.texi (Invocation): Fix URL in the example of the push hook.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-10-16 11:49:00 -04:00
Ludovic Courtès 8ce46502f1
base: Hide unused binding.
* src/cuirass/base.scm: Hide ‘build’ from (guix store).
2023-10-15 22:13:17 +02:00
Ludovic Courtès 55af0f70c0
base: Keep GC roots for derivations that are still queued.
Previously, ‘maybe-remove-expired-cache-entries’ would periodically
delete old GC roots, regardless of whether there were still builds
queued for them.  This approach addresses that.

Partly fixes <https://issues.guix.gnu.org/54447>.

* src/cuirass/base.scm (derivation-queued?, delete-old-gc-roots)
(spawn-gc-root-cleaner): New procedures.
* src/cuirass/scripts/register.scm (cuirass-register): Call
‘spawn-gc-root-cleaner’.
* src/cuirass/store.scm (gc-roots, gc-root-expiration-time): Remove.
(register-gc-roots): Remove call to ‘maybe-remove-expired-cache-entries’.
2023-10-15 22:07:41 +02:00
Ludovic Courtès f03b94ea26
Update TODO. 2023-10-15 17:56:33 +02:00
Ludovic Courtès 1d9606566a
remote-server: Improve logging.
* src/cuirass/scripts/remote-server.scm (run-fetch): Log the number of
outputs being fetched.
2023-10-15 16:15:40 +02:00
Ludovic Courtès 711981e4cb
base: Set the checkout thread’s name.
This is meant as a debugging aid.

* src/cuirass/base.scm (channel-update-service): Add call to
‘set-thread-name’ within ‘non-blocking’.
2023-10-15 16:15:16 +02:00
Ludovic Courtès 93e27ff07c
http: Really gracefully handle missing file on /download.
This is a followup to 103a6ec27b.

* src/cuirass/http.scm (url-handler): Remove ‘catch 'system-error’ for
“/download” handler since ‘respond-file’ cannot possibly throw to
'system-error.  Add explicit ‘file-exists?’ call instead.
2023-10-12 23:15:51 +02:00
Ludovic Courtès db6b633711
base: Update the mtime of GC roots still in use.
This should prevent GC roots from being evicted when they are in fact
still used by recent evaluations.

See <https://issues.guix.gnu.org/54447>.

* src/cuirass/store.scm (register-gc-root): Add call to ‘utime’ upon EEXIST.
2023-10-10 18:38:12 +02:00
Ludovic Courtès 598902a57d
remote-server: Add ‘--log-expiry’ option.
* src/cuirass/scripts/remote-server.scm (show-help, %options): Add
‘--log-expiry’ option.
(%default-options): Add default value.
(delete-old-build-logs, spawn-build-log-cleaner): New procedures.
(cuirass-remote-server): Call it.
* doc/cuirass.texi (Invocation): Document it.
2023-10-10 15:57:25 +02:00
Ludovic Courtès 343c92bbad
remote-server: Rename ‘zmq-start-proxy’.
* src/cuirass/scripts/remote-server.scm (zmq-start-proxy): Rename to…
(serve-build-requests): … this.  Update docstring.
(cuirass-remote-server): Adjust accordingly.
2023-10-10 12:15:45 +02:00
Ludovic Courtès 9d60a88b63
base: Create an actor for inactive jobsets.
Fixes a bug whereby inactive jobsets would not get a corresponding
actors.  Consequently, marking them as “active” in the database and/or
modifying their spec via the web UI wouldn’t have any effect.

* src/cuirass/base.scm (jobset-monitor): Check whether SPEC is active,
and if not, wait for an ‘update-spec’ message.
(jobset-registry): Pass #:filter-inactive? #f.
2023-10-10 12:03:51 +02:00
Ludovic Courtès d075b4d0f9
doc: Add “Triggering an Evaluation” section.
* doc/cuirass.texi (Triggering an Evaluation): New section.
2023-10-10 12:03:50 +02:00
Ricardo Wurmus 72a1fc58d5
http: Fix “/search/latest/archive” endpoint.
Fixes a regression introduced in c445d2d642.
Fixes <https://issues.guix.gnu.org/66384>.

* src/cuirass/http.scm (build->hydra-build): Include product id in
"buildproducts" field.
2023-10-09 15:51:04 +02:00
Ludovic Courtès e159c74ca6
remote: Improve logging in ‘receive-logs’.
* src/cuirass/remote.scm (receive-logs)[sockaddr->string]: New
procedure.
[read-log]: Add ‘address’ parameter and use it for logging.  Add clause
for EOF.
2023-10-06 11:55:23 +02:00
Ludovic Courtès d8de152f76
notification: Call ‘send-email’ in a separate thread.
This fixes a bug whereby the POSIX thread running the notification fiber
would be stuck in waitpid(2) while waiting for the mailer invoked by
‘mu-message-send’ to complete.

* src/cuirass/notification.scm (spawn-notification-fiber): Wrap
‘send-email*’ call in ‘non-blocking’.
2023-10-06 11:28:55 +02:00
Ludovic Courtès 6c64e60343
database: Avoid hard-coded build status constant.
* src/cuirass/database.scm (db-get-pending-build): Replace hard-coded -2
by (build-status scheduled).
2023-10-06 11:28:20 +02:00
Ludovic Courtès 797b26a4ef
http: Fix “/api/jobs/history” endpoint.
Fixes a bug introduced in c445d2d642 where
<checkout> records would end up being passed to ‘scm->json’.

* src/cuirass/http.scm (jobs-history->json-object): Pass checkouts
through ‘checkout->json-object’.
* tests/http.scm ("/api/jobs/history"): New test.
2023-10-01 16:15:21 +02:00
Ludovic Courtès d1486d71be
http: Factorize ‘checkout->json-object’.
* src/cuirass/http.scm (checkout->json-object): New procedure.
(evaluation->json-object): Use it.
2023-10-01 16:15:21 +02:00
Ludovic Courtès 0ebd0b632e
database: ‘db-get-jobs-history’ returns an alist keyed by symbols.
* src/cuirass/database.scm (db-get-jobs-history): Use symbols instead of
keywords as alist keys.
* src/cuirass/http.scm (jobs-history->json-object): Adjust accordingly.
* tests/database.scm ("db-get-jobs-history"): Adjust accordingly.
2023-10-01 16:15:06 +02:00
Ludovic Courtès 5ab13c5c88
doc: Expand intro to the web API.
* doc/cuirass.texi (Web API): Rename to…
(Web Interface): … this.  Add introductory text.
2023-10-01 16:02:33 +02:00
Ludovic Courtès 76d0537692
doc: Remove “API description” section heading.
* doc/cuirass.texi (Web API): Remove intermediate “API description”
node since it was the only section in this chapter.
2023-10-01 15:14:38 +02:00
Ludovic Courtès 40f70d28ae
remote-server: Fix memory corruption on the sender ID bytevector.
Fixes a bug whereby the sender ID bytevector returned by
‘receive-message’ could be modified behind our back (when the C msg
object is reclaimed) by the time it is passed as #:recipient to
‘send-message’.

As a result, ‘zmq-send’ would be passed an invalid peer ID and would
thus silently drop the message; the other end, ‘cuirass remote-worker’,
would wait for a reply to its ‘worker-request-work’ message that would
never come, thus remaining idle forever.

The bug has been there most likely forever, though it might have become
more frequent with the refactoring in
445198e2a0.

Thanks to Nicolas Dandrimont for putting me on the right track!

* src/cuirass/remote.scm (receive-message): Call ‘bytevector-copy’ on
the result of ‘zmq-message-content’.
* src/cuirass/scripts/remote-server.scm (zmq-start-proxy): Set
ZMQ_ROUTER_MANDATORY on BUILD-SOCKET.
2023-09-29 21:57:27 +02:00
Ludovic Courtès 02cacf5f6c
remote: Remove unused ‘zmq-poll*’.
* src/cuirass/remote.scm (zmq-poll*): Remove.
2023-09-29 21:41:27 +02:00
Ludovic Courtès d5582f2a56
remote: Simplify wait loop in ‘receive-message’.
* src/cuirass/remote.scm (receive-message): Simplify ‘wait’ loop.
2023-09-28 17:43:31 +02:00
Ludovic Courtès f08cd30afb
remote-worker: Using ‘ceiling-quotient’ for build parallelism.
* src/cuirass/scripts/remote-worker.scm (worker-management-thunk): Use
‘ceiling-quotient’ instead of ‘quotient’.
2023-09-28 14:39:59 +02:00
Ludovic Courtès 2d018ac62f
base: Really honor the period defined in a spec.
Fixes a regression introduced in
8fa6bcf1b9.

* src/cuirass/base.scm (jobset-registry): Honor SPEC’s period when it is
non-zero, passing it to ‘spawn-jobset-monitor’.
2023-09-28 12:03:43 +02:00
Ludovic Courtès 8fe3320106
database: Rename ‘with-db-worker-thread’ to ‘with-db-connection’.
This is a followup to c4743b5472.

* src/cuirass/database.scm (with-db-worker-thread): Rename to…
(with-db-connection): … this.
Adjust users.
* src/cuirass/metrics.scm: Likewise.
2023-09-26 16:46:45 +02:00
Ludovic Courtès 64568e7fee
database: ‘db-get-builds’ matches ‘db-get-pending-build’ ordering.
That way, the /api/queue endpoint returns something that matches actual
scheduling.

* src/cuirass/database.scm (db-get-builds): Adjust ordering for
‘status+submission-time’.
2023-09-26 16:38:56 +02:00
Ludovic Courtès 980ef61098
remote-worker: Statically determine build process parallelism.
Previously, build jobs would use the default #:max-build-jobs
and #:build-cores specified by guix-daemon.  This would typically lead
each worker to use as many cores as available, leading to unreasonable
over-commitment.

With this change, each worker is assigned a fraction of the build cores.
Because it’s a static policy, it may lead to resource waste, but avoids
the problem mentioned above.

* src/cuirass/scripts/remote-worker.scm (run-build): Add #:parallelism
and pass it to ‘set-build-options*’.
(run-command): Add #:parallelism and pass it to ‘run-build’.
(start-worker): Add #:parallelism and pass it to ‘run-command’.
(worker-management-thunk): Pass #:parallelism to ‘start-worker’.
* src/cuirass/remote.scm (set-build-options*): Add #:build-cores and
pass it to ‘set-build-options’, along with #:max-build-jobs.
2023-09-26 15:20:52 +02:00
Ludovic Courtès 317d8fc812
Update TODO. 2023-09-26 12:18:20 +02:00
Ludovic Courtès 0e2252176a
remote-server: Remove ‘%fetch-queue-size’ global variable.
* src/cuirass/scripts/remote-server.scm (%fetch-queue-size): Remove.
(fetch-worker): Define ‘queue-size’ and spawn a fiber to log its size.
(spawn-periodic-updates-fiber): Remove reference to ‘%fetch-queue-size’.
2023-09-26 12:10:58 +02:00
Ludovic Courtès 9d35eced9c
remote-server: Trim module imports.
* src/cuirass/scripts/remote-server.scm: Trim module imports.
2023-09-26 11:48:40 +02:00
Ludovic Courtès 15e9301a1f
parameters: Remove ‘%debug’ in favor of ‘current-logging-level’.
* src/cuirass/parameters.scm <top level>: Re-export ‘current-logging-level’.
(%debug): Remove.
* src/cuirass/scripts/remote-server.scm: Remove all (%debug) conditionals.
2023-09-26 11:35:25 +02:00
Ludovic Courtès e62012bae9
remote-server: Use a channel instead of a zmq inproc socket for downloads.
* src/cuirass/scripts/remote-server.scm (zmq-fetch-workers-endpoint)
(zmq-fetch-worker-socket, start-fetch-worker): Remove.
(fetch-worker, spawn-fetch-worker): New procedures.
(zmq-start-proxy): Add ‘fetch-worker’ parameter.  Remove
‘fetch-socket’.  Send message on ‘fetch-worker’ instead of
‘fetch-socket’.
(cuirass-remote-server): Call ‘spawn-fetch-worker’ only once.  Pass the
result to ‘zmq-start-proxy’.
2023-09-26 11:16:46 +02:00
Ludovic Courtès 9c25f943ed
base: ‘channel-update-service’ correctly reports system errors.
* src/cuirass/base.scm (channel-update-service): Add missing argument in
'system-error handling, and improve message.
2023-09-25 18:06:20 +02:00
Ludovic Courtès 06c33a8f9c
remote: Fix docstring of ‘zmq-socket->port’.
* src/cuirass/remote.scm (zmq-socket->port): Fix docstring.
2023-09-25 14:04:05 +02:00
Ludovic Courtès 7688e9888e
remote: ‘send-log’ ignores ‘close-port’ exceptions.
Previously, ‘close-port’ could throw, leading the calling fiber to
terminate prematurely.

* src/cuirass/remote.scm (send-log): Ignore errors when closing
COMPRESSED from the ‘catch’ handler.
2023-09-25 09:56:32 +02:00