diff options
author | Christopher Baines <mail@cbaines.net> | 2024-06-06 15:50:49 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-06-06 16:32:56 +0100 |
commit | 846aa141c8393ccb74e65c0160eff36620955ef9 (patch) | |
tree | 52028b2a74b7659167057a23baf54fc6c3f6f2da | |
parent | c18b7685779e402524466bc33309b641bc6a1861 (diff) | |
download | build-coordinator-846aa141c8393ccb74e65c0160eff36620955ef9.tar build-coordinator-846aa141c8393ccb74e65c0160eff36620955ef9.tar.gz |
Support controlling adding timestamps to the log output
So this can be turned off when the shepherd is adding the timestamps.
-rw-r--r-- | guix-build-coordinator/agent.scm | 11 | ||||
-rw-r--r-- | guix-build-coordinator/coordinator.scm | 11 | ||||
-rw-r--r-- | scripts/guix-build-coordinator-agent.in | 11 | ||||
-rw-r--r-- | scripts/guix-build-coordinator.in | 11 |
4 files changed, 32 insertions, 12 deletions
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm index a64a61c..7c00ca1 100644 --- a/guix-build-coordinator/agent.scm +++ b/guix-build-coordinator/agent.scm @@ -77,7 +77,8 @@ derivation-substitute-urls non-derivation-substitute-urls metrics-file - max-1min-load-average) + max-1min-load-average + timestamp-log-output?) (define lgr (make <logger>)) (define port-log (make <port-log> #:port (current-output-port) @@ -85,9 +86,11 @@ ;; In guile-lib v0.2.8 onwards, the formatter is ;; called with more arguments (lambda args ; lvl, time, str - (format #f "~a (~5a): ~a~%" - (strftime "%F %H:%M:%S" (localtime - (second args))) + (format #f "~a(~5a): ~a~%" + (if timestamp-log-output? + (strftime "%F %H:%M:%S " (localtime + (second args))) + "") (first args) (third args))))) diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm index 63f9eaf..9e5987f 100644 --- a/guix-build-coordinator/coordinator.scm +++ b/guix-build-coordinator/coordinator.scm @@ -364,7 +364,8 @@ (not (client-error? exn)))))) hooks (allocation-strategy - basic-build-allocation-strategy)) + basic-build-allocation-strategy) + (timestamp-log-output? #t)) (and (or (list? hooks) (begin (simple-format @@ -398,9 +399,11 @@ ;; In guile-lib v0.2.8 onwards, the formatter is ;; called with more arguments (lambda args ; lvl, time, str - (format #f "~a (~5a): ~a~%" - (strftime "%F %H:%M:%S" (localtime - (second args))) + (format #f "~a(~5a): ~a~%" + (if timestamp-log-output? + (strftime "%F %H:%M:%S " (localtime + (second args))) + "") (first args) (third args))))) (build-coordinator diff --git a/scripts/guix-build-coordinator-agent.in b/scripts/guix-build-coordinator-agent.in index 2f9e774..69ecf8a 100644 --- a/scripts/guix-build-coordinator-agent.in +++ b/scripts/guix-build-coordinator-agent.in @@ -126,6 +126,11 @@ (lambda (opt name arg result) (alist-cons 'metrics-file arg + result))) + (option '("timestamp-log-output") #t #f + (lambda (opt name arg result) + (alist-cons 'timestamp-log-output? + (string=? arg "true") result))))) (define %option-defaults @@ -140,7 +145,8 @@ (* 3 (/ (total-processor-count) 4))) 1)) (dynamic-auth-token - . ,(getenv "GUIX_BUILD_COORDINATOR_DYNAMIC_AUTH_TOKEN")))) + . ,(getenv "GUIX_BUILD_COORDINATOR_DYNAMIC_AUTH_TOKEN")) + (timestamp-log-output? . #t))) (define (parse-options options defaults args) (args-fold @@ -207,4 +213,5 @@ (or (assq-ref opts 'non-derivation-substitute-urls) (assq-ref opts 'substitute-urls)) (assq-ref opts 'metrics-file) - (assq-ref opts 'max-1min-load-average))))) + (assq-ref opts 'max-1min-load-average) + (assq-ref opts 'timestamp-log-output?))))) diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in index ad900c8..9246bbf 100644 --- a/scripts/guix-build-coordinator.in +++ b/scripts/guix-build-coordinator.in @@ -414,7 +414,12 @@ "error: ~A is not a known allocation strategy\n" arg) (exit 1))) - result)))) + result))) + (option '("timestamp-log-output") #t #f + (lambda (opt name arg result) + (alist-cons 'timestamp-log-output? + (string=? arg "true") + result)))) (append-map (lambda (hook) (list @@ -1085,7 +1090,9 @@ tags: #:database-uri-string (assq-ref opts 'database) #:hooks hooks-with-defaults #:allocation-strategy - (assq-ref opts 'allocation-strategy)))) + (assq-ref opts 'allocation-strategy) + #:timestamp-log-output? + (assq-ref opts 'timestamp-log-output?)))) (parameterize ((%show-error-details (assoc-ref opts 'show-error-details))) |