2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/guix-cuirass.git synced 2023-12-14 06:03:04 +01:00
Commit graph

1071 commits

Author SHA1 Message Date
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
Ludovic Courtès b97ea9d737
evaluate: Builds inherit their priority from the spec.
Previously, builds would all get the default priority, meaning that jobset
priority would effectively ignored when scheduling builds via
‘db-get-pending-build’.

* src/cuirass/scripts/evaluate.scm (user-alists->builds): Change
‘specification-name’ parameter to ‘spec’.  Set the ‘priority’ field of <build>.
(inferior-evaluation): Adjust call accordingly.
2023-09-22 11:21:29 +02:00
Ludovic Courtès f5c2bafc63
database: ‘db-get-pending-build’ returns older builds first.
* src/cuirass/database.scm (db-get-pending-build): Sort ‘timestamp’
in ascending order.  Clarify docstring.
* tests/database.scm (make-dummy-build): Add #:system, #:jobset, #:priority,
and #:timestamp.
("db-get-builds no-dependencies"): Remove.
("db-get-pending-build"): New test.
2023-09-22 09:17:05 +02:00
Ludovic Courtès c9914f90ea
remote-worker: Clarify ‘--systems’ argument.
* src/cuirass/scripts/remote-worker.scm (show-help): Clarify SYSTEMS.
2023-09-22 00:14:45 +02:00
Ludovic Courtès 8c6fe0be32
remote-server: Pop builds for any worker-supported system.
Previously, for workers supporting multiple systems, this would pick a
system at random and return #f, even if pending builds are available for
one of the other systems supported by the worker.  Thus, it would
practically divide throughput by N for a worker supporting N systems.

* src/cuirass/scripts/remote-server.scm (random-seed, shuffle): New
procedures.
(pop-build): Change to return a build for *any* of the systems supported
by WORKER.
2023-09-21 23:55:36 +02:00
Ludovic Courtès be79b1e406
templates: Show build machine and/or worker on build page.
Fixes <https://issues.guix.gnu.org/66059>.

* src/cuirass/templates.scm (build-details): Show build machine.

Reported-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-09-20 11:31:27 +02:00
Ludovic Courtès 6db8d6c5a9
templates: Show spec name on build page.
* src/cuirass/templates.scm (build-details): Show the spec name next to
the evaluation number.
2023-09-20 11:19:38 +02:00
Ludovic Courtès ae7ff698e0
base: Add comment giving an overview of the actors.
* src/cuirass/base.scm: Add commentary.
2023-09-17 15:39:57 +02:00
Ludovic Courtès 56902e7bc8
base: Define new “builder” actor with two implementations.
* src/cuirass/base.scm (%build-remote?): Remove.
(restart-builds): Add BUILDER argument; sent it the build request.
(build-packages): Remove.
(local-builder, spawn-local-builder)
(remote-builder, spawn-remote-builder): New procedures.
(jobset-evaluator): Add BUILDER argument.  Inline some of what was in
‘build-packages’.  Send build request to BUILDER.
(spawn-jobset-evaluator): Add #:builder and honor it.
* src/cuirass/scripts/register.scm (cuirass-register): Remove reference
to ‘%build-remote?’.  Cap THREADS at 8.  Define ‘builder’ and pass it to
‘spawn-jobset-evaluator’ and ‘restart-builds’.
2023-09-13 19:00:30 +02:00
Ludovic Courtès b0f93551bc
Move store and GC helpers from (cuirass base) to (cuirass store).
* src/cuirass/base.scm (default-gc-root-directory, %gc-root-directory)
(%gc-root-ttl, gc-roots, gc-root-expiration-time)
(register-gc-root, register-gc-roots)
(non-blocking-port, ensure-non-blocking-store-connection)
(with-store/non-blocking, process-build-log, build-derivations&): Move
to…
* src/cuirass/store.scm: … here.  New file.
* src/cuirass/scripts/remote-server.scm: Adjust accordingly.
* src/cuirass/scripts/remote-worker.scm: Likewise.
* src/cuirass/scripts/register.scm: Likewise.
* Makefile.am (dist_pkgmodule_DATA): Add ‘src/cuirass/store.scm’.
2023-09-13 19:00:12 +02:00
Ludovic Courtès b9f7f6e4a1
base: Add pages for structure.
* src/cuirass/base.scm: Add pages and comments.
(evaluate, evaluation-log-file): Move where they belong.
2023-09-13 19:00:12 +02:00
Ludovic Courtès f6645164ba
http: /admin/specification/edit notifies jobset via the bridge.
* src/cuirass/http.scm (url-handler): Send ‘update-jobset’ message to
BRIDGE.
* src/cuirass/scripts/register.scm (bridge): Handle ‘update-jobset’
messages.
2023-09-13 19:00:12 +02:00
Ludovic Courtès 0ddd43fd30
base: Implement ‘update-jobset’.
* src/cuirass/base.scm (jobset-monitor): Thread SPEC through the loop.
Introduce ‘perform-update’.  Implement ‘update-spec’ message handling.
(jobset-registry): Handle ‘update’ messages.
(update-jobset): New procedure.
2023-09-13 19:00:12 +02:00
Ludovic Courtès 7fdd780623
base: Move evaluations to a separate actor.
* src/cuirass/base.scm (start-evaluation, jobset-evaluator)
(spawn-jobset-evaluator): New procedures.
(jobset-monitor): Add #:evaluator.  Replace inline evaluation with a
message to EVALUATOR.
(spawn-jobset-monitor): Add #:evaluator and pass honor it.
(jobset-registry, spawn-jobset-registry): Likewise.
* src/cuirass/scripts/register.scm (cuirass-register): Call
‘spawn-jobset-evaluator’ and pass it to ‘spawn-jobset-registry’.
2023-09-13 19:00:11 +02:00
Ludovic Courtès c2ac72da03
http: Add /jobset/SPEC/hook/evaluate route to trigger a jobset.
* src/cuirass/base.scm (%jobset-trigger-rate-window)
(%jobset-trigger-maximum-rate): New variables.
(jobset-monitor): Replace 'sleep' call with 'get-message*'.  Define
'recent?' and 'rate'; use it to check whether the trigger rate is
exceeded.
* src/cuirass/http.scm (url-handler): Add /jobset/SPEC/hook/evaluate route.
* src/cuirass/scripts/register.scm (bridge): Handle 'trigger-jobset'
requests.
(show-help): Update ‘--interval’ description.
(cuirass-register): Increase default interval.
* doc/cuirass.texi (Invocation): Update ‘--interval’ documentation; add
a note documenting the push hook.
2023-09-13 15:44:16 +02:00
Ludovic Courtès 84e2a638ab
utils: Add 'get-message*'.
Taken from the Shepherd.

* src/cuirass/utils.scm (get-message*): New procedure.
2023-09-12 11:51:19 +02:00
Ludovic Courtès 7d86c5123c
http: Send jobset registration requests to the bridge.
* src/cuirass/http.scm (url-handler): Add 'bridge' parameter.
In "/admin/specification/add" route, write to BRIDGE.
(run-cuirass-server): Add #:bridge-socket-file-name.  When true, open
connection to the bridge.  Pass it to 'url-handler'.
* tests/http.scm ("cuirass-run"): Pass #:bridge-socket-file-name to
'run-cuirass-server'.
2023-09-12 11:51:19 +02:00
Ludovic Courtès d2794943d9
register: Listen for commands on a "bridge" socket.
* src/cuirass/base.scm (%bridge-socket-file-name): New variable.
* src/cuirass/scripts/register.scm (open-bridge-socket, bridge)
(spawn-bridge): New procedures.
(cuirass-register): Call 'spawn-bridge'.
2023-09-12 11:51:19 +02:00
Ludovic Courtès e4233a94ea
config: Define '%runstatedir'.
* configure.ac: Require 2.71.
* Makefile.am (do_subst): Substitute $(runstatedir).
* src/cuirass/config.scm.in (%runstatedir): New variable.
* src/cuirass/base.scm (%cuirass-run-state-directory): New variable.
* guix.scm <native-inputs>: Use AUTOCONF-2.71.
2023-09-12 11:51:19 +02:00
Ludovic Courtès 8fa6bcf1b9
base: Split jobset evaluation into several actors.
* src/cuirass/base.scm (process-specs): Remove.
(channel-update-service, spawn-channel-update-service)
(jobset-monitor, spawn-jobset-monitor)
(jobset-registry, spawn-jobset-registry)
(lookup-jobset, register-jobset): New procedures.
* src/cuirass/http.scm (url-handler): Add FIXMEs.
* src/cuirass/scripts/register.scm (cuirass-register): Remove 'build'
fiber and call 'spawn-jobset-registry' instead.  Error out on
'one-shot?'.
2023-09-12 11:51:19 +02:00
Ludovic Courtès 9b227abd29
http: Correctly render build products as JSON.
Fixes a bug introduced in c445d2d642 where
<build-product> records would end up being passed to ‘scm->json’.

* src/cuirass/http.scm (build->hydra-build): Convert <build-product>
records to alists.
2023-09-12 11:50:29 +02:00
Ludovic Courtès c20ca601c2
templates: Fix possible division by zero when rendering spec table.
Division by zero could happen in the unlikely case of a successful
evaluation containing zero jobs.

* src/cuirass/templates.scm (specifications-table)[summary->percentage]:
Check whether TOTAL is zero before dividing.
2023-09-12 10:40:13 +02:00
Ludovic Courtès 613188072c
templates: Avoid type error when displaying a jobset without evaluations.
Previously we’d pass #f to ‘eval-summary’ for jobsets that do not have
any successful evaluation.

* src/cuirass/templates.scm (specifications-table): Correctly handle
‘spec->latest-eval-ok’ returning #f.
2023-09-07 16:45:49 +02:00
Ludovic Courtès 647f13f0a9
http: /api/evaluations returns the full list of checkouts of each eval.
Previously it would only return checkouts changed compared to the
previous evaluation of that jobset.

* src/cuirass/http.scm (evaluation->json-object): Use ‘latest-checkouts’
instead of ‘evaluation-checkouts’.
* tests/http.scm (evaluations-query-result): Adjust accordingly.
2023-09-06 23:45:37 +02:00
Ludovic Courtès a057228492
database: Document the pitfalls of ‘db-get-checkouts’.
* src/cuirass/base.scm (latest-checkouts): Improve docstring.
* src/cuirass/database.scm (db-get-checkouts): Add docstring.
2023-09-06 23:39:25 +02:00
Ludovic Courtès 7a9194b15e
http: Really fix /jobsets for non-trivial build types.
* src/cuirass/http.scm (specification->json-object): Fix the non-trivial
cases for ‘build’.
2023-09-06 14:46:30 +02:00
Ludovic Courtès d4d0368cb8
http: /jobsets properly renders non-trivial build types.
Previously we’d get 500 for anything other than a symbol.

* src/cuirass/http.scm (specification->json-object): Handle build types
other than symbols describing a subset.
2023-09-06 12:33:35 +02:00
Ludovic Courtès 82c785d4f3
templates: Tolerate missing checkout info.
* src/cuirass/templates.scm (checkout-table): Tolerate CHECKOUT as #f.
2023-09-05 22:44:07 +02:00
Ludovic Courtès 64d7ad1109
database: ‘db-get-evaluations-absolute-summary’ returns a full summary.
* src/cuirass/database.scm (db-get-evaluations-absolute-summary): Extend
SQL query and fill out all the <evaluation-summary> fields.
* tests/database.scm ("db-get-evaluation-absolute-summary"): Check ‘status’.
("db-get-evaluations-absolute-summary"): Expect three results.
2023-09-05 16:04:03 +02:00
Ludovic Courtès 0930669024
templates: Fix broken evaluation display on the spec page.
Fixes a bug introduced in c445d2d642
whereby we’d call ‘evaluation-badges’ with #f as its first argument, due
to the last of a summary for LAST-EVAL.

* src/cuirass/templates.scm (specifications-table): When
LAST-EVAL-STATUS-OK? is false, call ‘broken-evaluation-badge’.
2023-09-05 15:08:49 +02:00
Ludovic Courtès c74a2a1332
templates: Factorize badges for broken evaluations.
* src/cuirass/templates.scm (broken-evaluation-badge): New procedure…
(evaluation-badges): … extracted from here.  Use it.
2023-09-05 15:08:43 +02:00
Ludovic Courtès 2a63a01519
http: Update to use symbols, not keywords, as keys on search results.
Fixes a regression introduced in
77bf78ecf7.

* src/cuirass/http.scm (url-handler): In “/search/latest” and
“/search/latest/PRODUCT-TYPE”, use symbols instead of keywords as the
second argument to ‘assoc-ref’.
2023-09-03 16:54:51 +02:00