Skip to content

Commit fc950c1

Browse files
committed
Try using PMAP-SOURCES everywhere.
This bins sources into one of 16 buckets for parallelization purposes.
1 parent 85a18d7 commit fc950c1

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

dist-cache.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ if needed."
187187
(directory (merge-pathnames "contrib/*.asd" base))))
188188
(dolist (file contrib-system-files)
189189
(setf (gethash (pathname-name file) table) file)))
190-
(map-sources
190+
(pmap-sources
191191
(lambda (source)
192192
(let ((base (ensure-cached-build-directory source))
193193
(system-files (system-files source)))

misc.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
(defun ensure-what-wins-you-can ()
233233
(call-with-skipping
234234
(lambda ()
235-
(map-sources
235+
(pmap-sources
236236
(lambda (source)
237237
(format t "~&Checking ~S~%" (project-name source))
238238
;;(clear-fasl-cache)

recrank.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
(defun recrank (&key (update t) (report t) (feeds t)
66
(publish-failure-report t)
7-
parallel
7+
(parallel t)
88
(file #p"quicklisp:tmp;update-failures.txt"))
99
(clear-fasl-cache)
1010
(preflight)

upstream.lisp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,24 @@
150150
(push source result))))
151151
(sort result 'string< :key 'name)))
152152

153-
(defun pmap-sources (fun &key (parallel-key #'source-host)
153+
154+
(defun source-bucket (source)
155+
"Return a string suitable for binning a source for parallel work."
156+
(subseq (string-digest (first-line-of (source-file source)))
157+
0 1))
158+
159+
(defun fasl-directory (source)
160+
(translate-logical-pathname
161+
(make-pathname :host "quicklisp-controller"
162+
:directory (list :absolute "dist" "fasls"
163+
(source-bucket source)))))
164+
165+
(defun pmap-sources (fun &key (parallel-key 'source-bucket)
154166
(test #'identity))
155167
(let ((dependency-tree (lparallel:make-ptree))
156168
(parallel-key-dependency (make-hash-table :test 'equal))
157-
(i 0))
169+
(i 0)
170+
(result '()))
158171
(map-sources (lambda (source)
159172
(let ((testp (funcall test source))
160173
(pkey (funcall parallel-key source)))
@@ -163,15 +176,22 @@
163176
parallel-key-dependency)
164177
(lambda (&optional arg)
165178
(declare (ignore arg))
166-
(map-source fun source))
179+
(multiple-value-bind (result error)
180+
(ignore-errors
181+
(map-source fun source))
182+
(when error
183+
(format *trace-output* "; ERROR: ~A -> ~%;; ~A~%"
184+
source error)
185+
(push (cons source error)
186+
result))))
167187
dependency-tree)
168188
(setf (gethash pkey parallel-key-dependency)
169189
(list i))
170190
(incf i)))))
171191
(lparallel:ptree-fn 'everything (loop for j below i collect j)
172192
(constantly nil) dependency-tree)
173193
(lparallel:call-ptree 'everything dependency-tree)
174-
nil))
194+
(values nil result)))
175195

176196
(defun project-name-source-file (project-name)
177197
(merge-pathnames

0 commit comments

Comments
 (0)