Open utterances-bot opened 4 years ago
mmh let me check, I am using Dexador with Lparallel.
With comments:
;; Sometimes, after a C-z or hibernation,
;; if we don't recreate the kernel, netwwork requests can hang.
(setf lparallel:*kernel* nil)
(setf lparallel:*kernel* (lparallel:make-kernel 4))
(get-all-titles)
…
;; where get-all-titles contains:
(lparallel:pmap 'list #'get-titles)
;; and get-titles contains:
(dex:get url)
As says the comment I have experienced hickups (timeouts too?) if I create the lparalell kernel, pauses my computer and run the high-level function again, without creating a new kernel. Hope that helps.
Do you know, when you are doing (setf lparallel:*kernel* nil)
it does not destroy lparallel's threads and they can stay in the system and eat resources?
I have this function to stop these workers completely:
(def (function e) stop-lparallel-threads ()
(setf lparallel.kernel::*lisp-exiting-p* t)
(unwind-protect
(loop for thread in (bt:all-threads)
when (string= (bt:thread-name thread)
"LParallel")
do (bt:destroy-thread thread))
(sleep 5)
(setf lparallel.kernel::*lisp-exiting-p* nil)))
Here "LParallel" is the name, I passed to the lparallel:make-kernel
as :name
argument.
Without settings lparallel.kernel::*lisp-exiting-p*
to t
, all lparallel threads are relaunched automatically by a supervisor thread.
cl-reddit
https://40ants.com/lisp-project-of-the-day/2020/06/0096-cl-reddit.html