guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/06: Improve verbose output for fetching build information


From: Christopher Baines
Subject: 02/06: Improve verbose output for fetching build information
Date: Sun, 1 Nov 2020 17:53:31 -0500 (EST)

cbaines pushed a commit to branch master
in repository data-service.

commit 5674f8838d7d2eac4df7e9a897571d9bd7e3bd19
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sun Nov 1 21:53:04 2020 +0000

    Improve verbose output for fetching build information
---
 guix-data-service/builds.scm | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/guix-data-service/builds.scm b/guix-data-service/builds.scm
index 4f2e5ed..41473fc 100644
--- a/guix-data-service/builds.scm
+++ b/guix-data-service/builds.scm
@@ -211,7 +211,8 @@ WHERE derivation_output_details.path = $1"
                                                       id
                                                       revision-commits))))
 
-(define (insert-build-statuses-from-data conn build-server-id build-id data)
+(define* (insert-build-statuses-from-data conn build-server-id build-id data
+                                          #:key verbose?)
   (define stop-statuses
     (lset-difference string=?
                      build-status-strings
@@ -235,8 +236,17 @@ WHERE derivation_output_details.path = $1"
          (assoc-ref data "starttime"))
         (stoptime
          (assoc-ref data "stoptime")))
+
+    (when verbose?
+      (simple-format #t "debug: existing statuses: ~A, new status: ~A\n"
+                     existing-status-entries
+                     status-string))
     (map (match-lambda
            ((timestamp status)
+            (when verbose?
+              (simple-format
+               #t
+               "debug: inserting status: ~A\n" status))
             (insert-build-status conn build-id timestamp status)))
          (filter
           list?
@@ -263,25 +273,24 @@ WHERE derivation_output_details.path = $1"
      ((build-id derivation-file-name)
       (match (fetch-build url derivation-file-name)
         (#f
-         (display ".")
+         (if (verbose-output?)
+             (display "debug: no build found\n")
+             (display "."))
          #f)
         (()
-         (display ".")
+         (if (verbose-output?)
+             (display "debug: no build found\n")
+             (display "."))
          #f)
         (data
          (insert-build-statuses-from-data
           conn
           build-server-id
           build-id
-          data)
-         (if (verbose-output?)
-             (simple-format (current-error-port)
-                            "debug: status: ~A\n"
-                            (assq-ref build-statuses
-                                      (or (assoc-ref data "buildstatus")
-                                          ;; status is for the /output/ 
requests
-                                          (assoc-ref data "status"))))
-             (display "-"))))
+          data
+          #:verbose? (verbose-output?))
+         (unless (verbose-output?)
+           (display "-"))))
       ;; Try not to make to many requests at once
       (usleep 200)))
    (select-pending-builds conn build-server-id)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]