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 17a306ad71
remote-server: Add some parallelism.
* src/cuirass/scripts/remote-server.scm (cuirass-remote-server):
Change #:parallelism.
2023-07-14 01:44:01 +02:00
Ludovic Courtès de8586080e
remote-worker: Fiberize.
This turns 'cuirass remote-worker' into a fiberized program instead of a
multi-process program (previously 'cuirass remote-worker' would create
one child process per actual "worker").

* src/cuirass/remote.scm (send-log): Pass SOCK_CLOEXEC | SOCK_NONBLOCK
to 'socket'.  Remove 'select' call.
* src/cuirass/scripts/remote-worker.scm (spawn-worker-ping): Replace
'call-with-new-thread' by 'spawn-fiber'.
(start-worker): Replace 'primitive-fork' by 'spawn-fiber'.
(worker-management-thunk): New procedure.
(%worker-pids, add-to-worker-pids!): Remove.
(signal-handler): Adjust accordingly.
(cuirass-remote-worker): Define 'management-channel'.  Spawn
a fiber running 'worker-management-thunk'.  Create workers by sending
message to MANAGEMENT-CHANNEL.
2023-07-14 01:38:10 +02:00
Ludovic Courtès ecac94d9d9
README: Add test instructions for 'remote-server' and 'remote-worker'.
* README (Database connection): Add example with 'remote-server' and
'remote-worker'.
2023-07-14 01:38:10 +02:00
Ludovic Courtès fa0c4b3b24
remote: Really check for ZMQ_POLLIN in 'receive-message'.
* src/cuirass/remote.scm (receive-message): Add missing (logand
ZMQ_POLLIN ...) around ZMQ_EVENTS.
2023-07-14 01:38:10 +02:00
Ludovic Courtès 9f3f625c1c
remote-worker: Add missing argument to 'log-info'.
Fixes a regression introduced in
b498ff8f75.

* src/cuirass/scripts/remote-worker.scm (cuirass-remote-worker): Add
missing argument to 'log-info'.
2023-07-13 17:35:33 +02:00
Ludovic Courtès 7079250d1b
remote-server: Fiberize.
This turns 'cuirass remote-server' into a fiberized program, as opposed
to a heavy-handed multi-threaded program.

* src/cuirass/remote.scm (receive-logs): Rewrite in Fibers style,
assuming non-blocking I/O calls and using 'spawn-fiber' instead of
'call-with-new-thread'.
(zmq-socket->port): New procedure.
(receive-message)[wait]: New procedure.
Call it upfront.
* src/cuirass/notification.scm (start-notification-thread): Rename to...
(spawn-notification-fiber): ... this.  Use 'spawn-fiber' instead of
'call-with-new-thread'.  Use (@ (fibers) sleep) instead of 'sleep'.
* src/cuirass/scripts/remote-server.scm (ensure-non-blocking-store-connection):
New procedure.
(add-to-store): Use it.
(start-fetch-worker): Use 'spawn-fiber' instead of
'call-with-new-thread'.  Remove 'set-thread-name' call.
(start-periodic-updates-thread): Rename to...
(spawn-periodic-updates-fiber): ... this.  Use 'spawn-fiber' instead of
'call-with-new-thread'.  Remove 'set-thread-name' call.
(zmq-start-proxy): Remove 'socket-ready?', '%loop-timeout', and
'poll-items'.  Use 'spawn-fiber' for the worker list update.  Remove use
of 'zmq-poll*' in the main loop.
(terminate-helper-processes): New procedure.
(signal-handler): Use it instead of inline code.  Call 'primitive-exit'
rather than 'exit'.
(cuirass-remote-server): Wrap body in 'run-fibers'.
* tests/database.scm ("database")["db-init"]: Remove
'start-notification-thread' call.
["mail notification", "mail notification, broken job"]: Add call to
'spawn-notification-fiber'.
2023-07-10 00:01:03 +02:00
Ludovic Courtès cfa4516619
tests: 'retry' uses (@ (fibers) sleep) when appropriate.
* tests/common.scm (retry): Use (@ (fibers) sleep)
when (current-scheduler) is true.
2023-07-09 23:38:51 +02:00
Ludovic Courtès bb20f29ee9
tests: Tweak 'mail.sh' helper.
* tests/mail.sh: Use /bin/sh, tail-call 'cp'.
2023-07-09 22:32:23 +02:00
Ludovic Courtès 53c9e330da
tests: Disambiguate test name.
* tests/database.scm ("database"): Rename second "mail notification"
test to "mail notification, broken build".
2023-07-09 22:31:48 +02:00
Ludovic Courtès 8cc66d0269
tests: Increase logging level for database tests.
* tests/database.scm: Call 'current-logging-level'.
2023-07-09 22:31:02 +02:00
Ludovic Courtès 0e6241d915
logging: Export 'current-logging-level'.
* src/cuirass/logging.scm (current-logging-level): Export.
2023-07-09 21:48:23 +02:00
Ludovic Courtès 60ea285865
tests: Adjust timeout test.
* tests/remote.scm (dummy-drv): Print something in build log before and
after 'sleep' call.
(drv-with-timeout): Change argument to 10.
2023-07-09 18:54:10 +02:00
Ludovic Courtès 634208a4ae
remote: Fix router bootstrap message case in 'receive-message'.
* src/cuirass/remote.scm (receive-message): Fix second 'match' clause
in ROUTER? case.
2023-07-09 18:49:04 +02:00
Ludovic Courtès 22ce3b9de2
remote-worker: Clarify that an empty bytevector is expected when connecting.
* src/cuirass/scripts/remote-worker.scm (start-worker)[read-server-info]:
Replace 'empty' variable with a literal empty bytevector.
2023-07-05 16:18:29 +02:00
Ludovic Courtès 41eecd1f53
Add missing copyright line.
* src/cuirass/remote.scm, src/cuirass/scripts/remote-server.scm: Add
copyright line for commit 445198e2a0 and
earlier.
2023-07-02 18:21:18 +02:00
Ludovic Courtès 445198e2a0
remote: Simplify interface to send and receive messages.
This hides serialization/deserialization, assembly of message parts, and
the actual send/receive operation behind 'send-message' and
'receive-message'.

* src/cuirass/remote.scm (zmq-remote-address)
(zmq-message-string, zmq-read-message): Remove.
(send-message, receive-message): New procedures.
* src/cuirass/remote.scm (build-request-message):
(no-build-message, build-started-message)
(build-failed-message, build-succeeded-message)
(worker-ping, worker-ready-message)
(worker-request-work-message)
(worker-request-info-message, server-info-message): Remove 'format'
call and return an sexp instead.
* src/cuirass/scripts/remote-server.scm (read-worker-exp):
Add #:peer-address.  Change 'msg' to 'sexp'.
(need-fetching?): Remove call to 'zmq-read-message'.  Remove
inappropriate use of 'else' keyword.
(run-fetch): Remove call to 'zmq-read-message'.  Use 'receive-message'
instead of 'zmq-message-receive*' & co.
(zmq-start-proxy): Use 'receive-message' and 'send-message' instead of
'zmq-message-receive*', 'zmq-message-send' & co.  Pass #:peer-address to
'read-worker-exp'.
* src/cuirass/scripts/remote-worker.scm (run-command): Remove call to
'zmq-read-message'.
(spawn-worker-ping)[ping]: Use 'send-message'.
(start-worker): Use 'send-message' and 'receive-message' instead of
the whole shebang.
2023-07-01 00:11:02 +02:00
Ludovic Courtès 1e5b87b0a6
remote: Remove 'zmq-' prefix from our own message bindings.
* src/cuirass/remote.scm (zmq-build-request-message)
(zmq-no-build-message, zmq-build-started-message)
(zmq-build-failed-message, zmq-build-succeeded-message)
(zmq-worker-ping, zmq-worker-ready-message)
(zmq-worker-request-work-message, zmq-worker-request-info-message):
Strip 'zmq-' prefix from the name.
(zmq-server-info): Rename to...
(server-info-message): ... this.
* src/cuirass/scripts/remote-server.scm: Adjust accordingly.
* src/cuirass/scripts/remote-worker.scm: Likewise.
(worker-ping): Rename to...
(spawn-worker-ping): ... this.
2023-06-29 22:36:17 +02:00
Ludovic Courtès c989e60170
remote: Remove unused variable.
* src/cuirass/remote.scm (%zmq-context): Remove.
2023-06-29 22:16:17 +02:00
Ludovic Courtès ec44dba635
remote-server: Correctly check the result of 'zmq-poll'.
This partially reverts bb7579acc0, which
introduced an incorrect membership test with 'memq'.

* src/cuirass/scripts/remote-server.scm (zmq-start-proxy)[socket-ready?]:
New procedure.
Use it when checking the result of 'zmq-poll*'.
2023-06-29 11:47:51 +02:00
Ludovic Courtès b498ff8f75
remote: Add more logging.
* src/cuirass/scripts/remote-server.scm (read-worker-exp)[update-worker!]:
Add 'log-debug' call.
* src/cuirass/scripts/remote-worker.scm (start-worker): Add 'log-info'
calls.
(cuirass-remote-worker): Likewise.
* tests/remote.scm (start-worker, start-server): Set 'CUIRASS_LOGGING_LEVEL'.
2023-06-29 11:44:56 +02:00
Ludovic Courtès 480ae5440d
Show the right program name in '--version'.
* src/cuirass/scripts/remote-server.scm (%options): Fix program name
passed as a 'show-version-and-exit' argument.
* src/cuirass/scripts/remote-worker.scm (%options): Likewise.
2023-06-28 23:41:56 +02:00
Ludovic Courtès ae4179907f
database: 'db-get-latest-checkout' might get zero rows.
* src/cuirass/database.scm (db-get-latest-checkout): Remove call to
'expect-one-row' and adjust 'match' pattern accordingly.
2023-06-26 23:36:24 +02:00
Ludovic Courtès d2ba893a39
doc: Document '--build-remote'.
* doc/cuirass.texi (Invoking cuirass register): Document
'--build-remote'.
(Invoking cuirass remote-server): Mention it.
2023-06-26 23:17:22 +02:00
Ludovic Courtès cbe31acdee
.guix-authorizations: Add Maxim Cournoyer to the committers.
* .guix-authorizations: Add key for apteryx.
2023-06-22 21:52:54 +02:00
Ludovic Courtès b724dfa322
http: Evaluation dashboard shows the full list of channels.
This is a followup to c7db7f88a2, which
would only show, say, 'guix-past' and not 'guix' (the latter being a
dependency of the former).

* src/cuirass/http.scm (dashboard-page): Call 'latest-checkouts' and
pass #:checkouts to 'evaluation-dashboard'.
* src/cuirass/templates.scm (evaluation-dashboard): Add #:checkouts and
honor it.
2023-06-18 15:14:38 +02:00
Ludovic Courtès 6c877943da
remote-server: Slight clarification.
* src/cuirass/scripts/remote-server.scm (zmq-start-proxy): Move
'fetch-msg' right where it's used.
2023-06-18 15:14:35 +02:00
Ludovic Courtès bb7579acc0
remote: Remove 'zmq-socket-ready?'.
* src/cuirass/remote.scm (zmq-socket-ready?): Remove.
* src/cuirass/scripts/remote-server.scm (zmq-start-proxy): Use 'memq'
instead.
[socket-ready?]: Remove.
2023-06-18 14:53:07 +02:00
Ludovic Courtès c74d60d194
http: Add 'Cache-Control' header on /static files.
* src/cuirass/http.scm (%static-file-ttl): New variable.
(url-handler)[respond-file]: Add #:ttl and honor it.
[respond-static-file]: Pass #:ttl.
2023-06-15 14:12:08 +02:00
Maxim Cournoyer 7c9fc0645e
doc: Document authentication.
* etc/new-client-cert.scm: Add script.
* doc/cuirass.texi (Authentication): Document it.
* Makefile.am (noinst_SCRIPTS): Register it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-06-14 23:15:12 +02:00
Ludovic Courtès b76c04199f
http: Show a longer build history.
* src/cuirass/http.scm (url-handler): in "/build/N/details", increase
'nr' for the build history.
2023-06-13 11:05:06 +02:00
Ludovic Courtès a46419fe42
http: Add route for "/eval/latest?spec=...".
* src/cuirass/http.scm (url-handler): Add route for
"/eval/latest?spec=...".
2023-06-12 23:28:30 +02:00
Ludovic Courtès c7db7f88a2
templates: Evaluation dashboard shows completion time and commits.
* src/cuirass/templates.scm (evaluation-dashboard): Rename 'evaluation'
to 'evaluation-id'.  Add #:channels.  Add 'details' block showing
completion time and checkouts.
2023-06-12 23:28:28 +02:00
Ludovic Courtès 8a4cb66123
templates: Factorize 'checkout-table'.
* src/cuirass/templates.scm (checkout-table): New procedure.
(evaluation-build-table): Use it.
2023-06-12 23:28:12 +02:00
Ludovic Courtès 7d9d7c843d
templates: Evaluation dashboard links to evaluation page.
* src/cuirass/templates.scm (evaluation-dashboard): Link to evaluation
page.
2023-06-12 23:28:11 +02:00
Ludovic Courtès 36851deac3
README: Adjust 'guix shell' instructions.
* README: Expose X.509 certificates.  Fix typos.
2023-06-12 22:16:47 +02:00
Ludovic Courtès b82596778b
README: Update instructions for development and testing.
* README (Requirements): Add '--expose' and explain.
(Database connection): Add example with 'pg_tmp'.
2023-06-02 11:11:48 +02:00
Ludovic Courtès f92fba1184
base: Log successful checkouts.
* src/cuirass/base.scm (process-specs): Add 'log-info' call in
'new-channels' value.
2023-06-02 10:01:27 +02:00
Ludovic Courtès d8ac891e0d
base: Remove extra 'log-error' call.
Typo introduced in 93d51df182.

* src/cuirass/base.scm (process-specs): Remove extra 'log-error' call.
2023-06-02 10:00:17 +02:00
Ludovic Courtès 8eb67256a1
examples: Add spec for Cuirass.
* examples/cuirass.scm: New file.
* Makefile.am (EXTRA_DIST): Add it and 'examples/hello.scm'.
2023-06-02 09:49:41 +02:00
Ludovic Courtès b719f7df47
http: Remove unused variable.
* src/cuirass/http.scm (url-handler): Remove unused 'params' variable.
2023-06-02 00:28:22 +02:00
Ludovic Courtès 63b5f6db80
base: Fix logging levels for build logs.
* src/cuirass/base.scm (handle-build-event): Use logging levels more
appropriate than 'log-error'.
2023-06-02 00:28:22 +02:00
Ludovic Courtès d0b08b0d40
http: Add /eval/latest/dashboard endpoint.
* src/cuirass/http.scm (url-handler)[redirect]: New procedure.
Add clause for /eval/latest/dashboard.
* src/cuirass/templates.scm (specifications-table): Link to it.
2023-06-02 00:28:22 +02:00
Ludovic Courtès 0eb24588be
base: 'spawn-builds' keeps going upon build failure.
* src/cuirass/base.scm (spawn-builds): Add 'set-build-options' call.
Previously, we'd build with #:keep-going? #false, which made Cuirass
build very little when not using the "remote worker" mechanism.
2023-06-02 00:28:22 +02:00
Ludovic Courtès 93d51df182
base: Catch all errors occurring while processing a spec.
Previously, an error such as 'system-error would be uncaught, which
would (presumably) lead 'cuirass register' to exit right away, via
'essential-task'.

* src/cuirass/base.scm (process-specs): Use 'with-exception-handler' +
'let/ec' instead of 'catch'.  Report 'system-error' exceptions in
detail.  Print other exceptions as well.
2023-06-02 00:28:21 +02:00
Ludovic Courtès 341525a901
logging: Use 'match' instead of 'cond'.
* src/cuirass/logging.scm (log-message): Use 'match' instead of 'cond'.
2023-06-02 00:28:17 +02:00
Ludovic Courtès e50469877b
logging: Always log errors.
Fixes a regression introduced in
f1f0489ed7 where 'error-level messages
would never be logged.

* src/cuirass/logging.scm (log-message): Always log errors.
2023-06-01 19:00:21 +02:00
Ludovic Courtès 425ede115e
utils: Remove 'put-message-with-timeout' and 'get-message-with-timeout'.
These primitives are no longer used.  They're also antithetical to the
"communicating sequential processes" (CSP) model where communication is
synchronous and lack of a recipient or sender can lead to lockups.

* src/cuirass/utils.scm (with-timeout)
(put-message-with-timeout, get-message-with-timeout): Remove.
2023-05-31 16:20:30 +02:00
Ludovic Courtès cd94670f1d
utils: Remove "worker thread" helpers.
* src/cuirass/utils.scm (%worker-thread-args)
(make-worker-thread-channel, call-with-worker-thread)
(with-worker-thread): Remove.
2023-05-31 16:20:29 +02:00
Ludovic Courtès c4743b5472
database: Use a connection pool.
With 'exec-query' from (squee) no longer blocking, we no longer need to
carry out 'exec-query' calls in a dedicated worker thread.  However, it
is useful to have a pool of database connections at hand to allow for
concurrent queries.

Thanks to Christopher Baines for suggesting the use of a connection pool.

* src/cuirass/database.scm (%db-channel): Remove.
(%db-connection-pool, %db-connection-pool-size): New variables.
(with-database): Rewrite to use 'make-resource-pool' when in a fiber
context.
(current-db): New variable.
(with-db-worker-thread): Rewrite to use 'current-db' or
'with-resource-from-pool' when appropriate, and plain 'db-open'
otherwise.
* tests/common.scm (test-init-db!): Remove reference to '%db-channel'.
* tests/database.scm (with-fibers): New macro.
Use it throughout.
* configure.ac: Check whether Guile-Squee is recent enough.
2023-05-31 16:20:29 +02:00
Ludovic Courtès 1f0e059557
utils: Add resource pool.
* src/cuirass/utils.scm (make-resource-pool)
(call-with-resource-from-pool): New procedures.
(with-resource-from-pool): New macro.
2023-05-31 16:20:27 +02:00